community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
#SANTALYTICS

The highly anticipated Alteryx Community tradition is back! We hope you'll join us!

Learn More

Polling a directory for changed files

Meteoroid

Hi all,

 

I have a workflow that I wanted to run only when a new file was available, so I scheduled the following workflow which I thought might be useful for others.

 

The basic approach is to first save the initial state of the target directory to a file (run once during initial set up), and then periodically check files in the directory to see if any details have changed. This is done by joining the directory details from the previous run to the current state. The join matches on FileName, CreateTime, LastWriteTime and Size and a final Test Tool returns True if there have been changes (i.e. not all records matched). You'll just need to update the input and output tools to match a) the directory you want to check and b) the location where you'd like to store the directory listing snapshots. You can optionally set the tool to perform some action 'After run without errors'.

 

Get initial state of directory (Get directory listing RUN ONCE v0.01.yxmd) - This is run once

 Polling directory RUN ONCE.PNG

Check for changes (Polling directory for file changes v0.01.yxmd) - This can be scheduled to check at the desired interval

Polling directory.PNG

Workflow files are attached below. Improvements are obviously welcomed, but would love to hear if anyone finds it useful!

Nebula
Nebula

:-) this is useful - especially if part of your job is managing any large file folder (for example - we monitor our dev assets to make sure that they haven't changed without the proper change control)

 

Nice!

Atom

This is really useful for me. My scenario needed 2 files to have been replaced since the last run before allowing the full workflow to run, so was able to make the required changes in the check to allow for that. I could improve it further to check that the specific files had changed rather than just the number of changed files had changed.

 

I'm unsure though where the polling times are set? I'd like to have this run every 10 mins during a 6 hour window each work day until it finds that the 2 files have been replaced. Any suggestions?

Meteoroid

To run it on a regular basis, you'll need Alteryx desktop scheduler (separate licence) or Alteryx Server, not sure if you have access to either of these? If so, then polling times will just be a result of the schedule frequency. Unfortunately, you can't trigger Alteryx workflows without these to the best of my knowledge.

Labels