Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


David Edelman
2019-08-02T01:44:09Z
Hi

We are receiving files via FTP from a customer. Their process will send these files even if they have not been updated with new data.
We would like to :

1 Check all files received in a folder meeting a certain wildcard (e.g. *.txt) ,
2 Check (Fail/success) that the last modified date of each file was within the last x minutes from the current date / time.
2 If a fail we would like to send through an alert email with the files(s) and discontinue the process.
3 If success we will continue with the subsequent process.

Hope there is an easy solution for this and even better existing scripts than can be used.

Thanks in advance.
Sponsor
Forum information
Support
2019-08-02T07:41:29Z
Maybe you can use a File Trigger on that folder and it will react directly on files matching a certain file mask?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Joey S
2019-08-05T21:30:42Z
Are you receiving the file through an FTP command used in VC or are you doing that separately?
- If you are using VC to download the file through FTP, you can have it only download files modified or created during a certain date range or within the last X minutes.
- If you set the Date filter for FTP and there are files that exist that meet your criteria, you can use that output as the attachment and the next step. ie. If no file, stop the job, if there is a file, email this attachment

If the answer to the question above is No and you have another process to receive the file, then a trigger on the folder would be sufficient. Set the trigger to start a task "Touch File" with the following settings:
Folder = {TRIGGER(ID|File.Result.Folder)}
File mask={TRIGGER(ID|File.Result.Name)}
(don't copy/paste these, you will need to find them in the Variables)
Under the Date tab- Set the Modified > {DATENOWADD(Minutes|-10|M/d/yyyy h:mm tt)}
(don't set the top one, that is Date Modified LESS THAN <)
Press Test to see the results
What this does is, after the task is triggered, it will look at the file that did the triggering and IF the date modified was in the last 10 minutes (that's the "-10" in the variable string above, pick your own if you want something different), then you will get an output for this task

NOW...Setup an email task AND a condition
The condition will be a VisualCron condition type where you pick the Specific Task from above (Touch File) and the Task Output is set to Contains: {TRIGGER(Active|LastTrigger|File.Result.Name)}

So. What you have done is allowed any file entering your folder X to trigger Task - Touch File, but the Output of that Task only exists IF the file meets the Date criteria (in my example, the file was modified less than 10 minutes prior) and if that condition is met, it will email someone. You could also add in a VC task to Stop the whole job once this is done and maybe tell it to start again later using Job Task Control

Sorry, that got to be a little long and is not that pretty but it will definitely work. Honestly, it is way easier to let VC go find the file on the FTP server and work with that output.

😄

Scroll to Top