I’m trying to analyze a log file from a FB script. I need to get the most recent file in a directory. What I do is log the date and time into a variable and then set the FileSet pattern to look for a file after this date and time. This seems to work if I just run a portion of my script but fails each time I run the whole 3 hour script. When I look in the log at the date/time I have set into the variable and the date/time the file was created everything appears to be OK, yet, I get 0 files returned.
1. Is there an easier way to accomplish this?
2. In what format do I need to store the date and time so that it is usable by the FileSet pattern definition?
3. The FileSet patterns only allows * wildcards not ?, is this correct?
Hi Larry,
1) There are other ways to do this, I don’t know if they are easier, though, and you should be able to do it with a FileSet. We’ll look into a “Sort FileSet” action for a future version of FB.
Otherwise, there are a couple of VBScript functions on this thread which use the FileSystemObject to find the newest file in a directory:
http://www.codecomments.com/archive300-2006-2-551110.html
2) The date/time will need to be stored in the current locale’s date/time format. "In the US, this is commonly MM/DD/YY HH:MM:SS format."
3) No, the patterns should support ? as well as *.
How does the date/time you are getting from the Get Date/Time action compare to the modification date of the file you wish to match? Are you sure the file has been created/modified after the “now” date/time that you are receiving using the action?
- Angus
Thanks Angus this works great in the Run Script action. I thought I would take it one step further and attempt to make a Custom Action with Action Studio. I have posted question in the Action Studio forum directly related to this question. Can you please look for " Help With Script Error" there?