Get file name and use it in a 'Execute' task - VisualCron - Forum

Community forum

devonway
2011-03-30T01:47:45Z
We are trying to zip up some files but cannot get the exact file names using VisualCron.
The file name is like test_20110329_1159.txt
We can use a mask for date but cannot get the time since that may change everyday slightly. I tried to use conditions but not sure how to use variables in conditions.
Any ideas are welcome.

Thanks,
Ops
ErikC
2011-03-30T09:30:10Z
Hi Ops,

When do you want to zip this file?
You might want to use a file trigger on the folder when the file is placed.
With the variables of the file trigger you can get the exact filename and use this in the archive task.

Regards
Erik
Uses Visualcron since 2006.
devonway
2011-03-30T23:20:25Z
Sorry, forgot to mention that we cannot use the File Arrive Trigger in this case as we need another job to complete processing this and a bunch of other files first. I cannot trigger on the completion of this job either, as this job runs several times.
ErikC
2011-03-31T07:57:29Z
So you're telling me when the 'test_20110329_1159.txt' is placed/created in the folder the file isn't ready to process?

Is this file the only file in the dir?

😕 The main question is: When do you know the file is ready to process?

😒 You could use the file trigger in the job, use the put the 'job in the queue' feature. Have a wait task in there and on the next task have a condition to check if the zip may continue, if not, jump back to the wait task. When the condition is met, you still have the filename in the file trigger variables.
Other files are not lost because of the job queue.

😢 A different approach is using a batch file for this.
You can use the 'dir test_{dateformat}_*.txt /b' as the input for a for loop. You than need an external zip utility to process the files.

Hope this helps.

Regards
Erik
Uses Visualcron since 2006.
devonway
2011-03-31T22:32:11Z
So you're telling me when the 'test_20110329_1159.txt' is placed/created in the folder the file isn't ready to process?
-Yes
Is this file the only file in the dir?
No

The main question is: When do you know the file is ready to process?
-We know that this file is ready to process when the last of the files is zipped up and put in another folder.

Thanks for the ideas. I did play around with the first approach (putting job in queue) but it didn't remember all of the triggers.

We settled on setting the time in a variable and then using it to actually name the file, so that we know the exact file name.

Thank you!
Ops
Scroll to Top