[Solved] Setting a Variable to File Name Post Completion of an FTP File... - VisualCron - Forum

Community forum

stevja01
2012-08-16T14:40:17Z
As part of a VisualCron job I am creating a report using third party software and saving the report to an FTP site. The report name always starts with the same mask, however the report ends with the period end date for the data within the report which could be any date. Is there a way to get the newest report name matching the file mask and then setting a variable to that report name so that it can be used in a automatic email to an external party?

On a side note, we are using VisualCron v4
Support
2012-08-16T14:43:17Z
Unfortunately version 4 does not have the same file and date filter as version 6. I think you need to create a script outside VisualCron to solve this - or upgrade.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
stevja01
2012-08-16T14:56:05Z
In version 6, is this something we can pull using the Read File task or ?
Support
2012-08-16T15:05:05Z
If I understood you correctly you wanted to email a report based on name right?

One thing you could do with both version 4 and 6 is to use a file trigger on the folder where the files are created. Then you can email the file that was created.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
stevja01
2012-08-16T15:08:11Z
Unfortunately the file is too large to even open on a normal client machine, I believe our client imports the data into a d/base (SQL, Oracle) to use it. So in summary I can't go the attachment route. I would like to just go to a specific directory like C/Documents/, then get the name of the newest file saved there that starts with XYZ_ABC_*.* and set a variable to the name of that file so that I can alert my customer to the name of the newest report file.
Support
2012-08-16T15:11:36Z
With the file trigger you do not need to open the file. It will just react on when it is created. Then you can use the Variables to get the file name that was created.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
stevja01
2012-08-16T18:58:07Z
We found a way to do this using a Macro in Excel so we're good for now.
ErikC
2012-08-17T06:29:28Z
Hi stevja01,

You could use a batch file like this to do this for you also:

:: gets the newest file name based on the 1st parameter

@echo off
for /f %%a in ('dir /b/o-d %1') do (
echo %%a
exit /b
)


If you save this as a text file named 'GetLatest.bat' you could run it after you created your report with a execute task like: GetLatest.bat XYZ_ABC_*.*

You will receive the newest report name.
The output of this task you could use as a variable in upfollowing tasks.

Regards,
Erik
Uses Visualcron since 2006.
stevja01
2012-08-17T17:19:53Z
Scroll to Top