file last modified time - Command

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

file last modified time - Command

Post by kpassaur » Sat Jan 15, 2005 2:38 am

I'm looking for an easy way to get a string that I can parse out the last modified time of a file

I have a script that processes all the files in a directory and I use the getfilelist and separate command - it works like a charm unless new files are being created and placed in the folder

Let me explain the files being processed by the script are image files that are created in the file folder (not copied in). Since the files are large they take some time to create. What happens is that as the file is being created the file name is created before the file is finished being created. (makes sense when you think about it) However, the Getfilelist command reads this file name and tries to process it. When this happens the file processing fails.

So, I am looking for a way to get the time in minutes from a file name. I was thinking of the Dos directory command and writing all the file names to a text file. Parse out the text file and use the VB Script Minute(Now) and only process the files that are two or more minutes old.

However, this script replays is self every minute, even it there are no files to process. I don't want to create and delete a text file every minute if there are no files to process. Or only one or two files.

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Sat Jan 15, 2005 3:31 am

kpassaur,

Just a thought.
Instead of parsing for time, would this work:
Use GetFileList to create list1
Wait>60
Use GetFileList to create list2
Wait>60
Use GetFileList to create list3
Process list1
Wait>60
Use GetFileList to create list4
Process list2
Wait>60
Use GetFileList to recreate list1
Process list3
Wait>60
Etc....

Subroutines and an endless loop

Hope this helps,

Dick

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sat Jan 15, 2005 4:56 am

Here is a single line of DOS commands that results in a single line file with data and time in the first 18 characters. Processes involved:
1. Do a directory listing for the specific file.
2. Pipe the result into FIND to get the single line result.
3. Redirect the result into a text file to read and parse.

Code: Select all

Dir C:\SourcePath\Filename.ext|Find /I "Filename.ext" >lasttime.txt 
Sample result:
12/14/03 05:34 AM.................... 24,673 Filename.ext

So you could use:

Code: Select all

Run Program>command.com /c Dir C:\SourcePath\Filename.ext|Find /I "Filename.ext" >lasttime.txt
Then read that single line and parse it.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts