How do I check Excel File exists within an Automation script

Is it possible to activate an automation script when a specific named file is found in the pre-determined location?

What I’m looking for is a way for a daily scheduled automation script to poll a directory / folder and search for a specific named file.

If this file is found then the rest of the automation script is run through, a results file is created (with a time stamp suffix) and then the source file is moved or deleted.

Else the automation stops and waits until the next day before trying again.

A user placing the source data file on any given day in this location can expect to have the results file the next day.

This would allow none TDA users to dictate when an automation script is run and re-run.

It may also be possible to reduce the polling time period to every hour to speed up the process. But this may increase processing overhead.

Anyone else looked at this?

Thank you in advance.


I’d think you’d have to create a batch file or Windows script that performs the conditional logic you’re needing. The batch/script could then call the TDA automation script, via the command-line, and execute the desired process.

When you schedule an automation script in TDA, you’ll notice that it generates the command-line call to TDA to perform the automation. You could use that call in your batch/script file that’s performing the conditional logic.

Why not to schedule automation script rather that call TDA from inside the batch? I would suggest creating a script implementing the logic you need and scheduling it to run continuosly with the interval equal to your polling period (1 day). Such script would include running a batch (Run Program activity) which should check your specifically named file presence in the pre-determined location. That batch should exit with different exit code depending on whether that file was found or not. Exit code is saved in the return code variable which can be analyzed later in the If…Condition… activity.


Can someone post a sample script to illustrate how this can be done?

I would like to use this logic to import if a CSV file exist.