Community forum

Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
View
Go to last post Go to first unread
Offline David Edelman  
#1 Posted : Friday, August 2, 2019 3:44:09 AM(UTC)
David Edelman

Rank: Paid support

Joined: 5/24/2018(UTC)
Posts: 1
Australia
Location: New South Wales, Newcastle

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.
Offline Support  
#2 Posted : Friday, August 2, 2019 9:41:29 AM(UTC)
Support

Rank: Official support

Joined: 2/23/2008(UTC)
Posts: 11,167

Thanks: 868 times
Was thanked: 443 time(s) in 421 post(s)
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!
Offline Joey S  
#3 Posted : Monday, August 5, 2019 11:30:42 PM(UTC)
Joey S

Rank: Paid support

Joined: 3/26/2018(UTC)
Posts: 9
United States
Location: North Dakota, Grand Forks

Was thanked: 4 time(s) in 3 post(s)
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.

Smile

thanks 1 user thanked Joey S for this useful post.
Support on 8/6/2019(UTC)
Users browsing this topic
Guest
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Scroll to Top