Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking a folder for new files

Status
Not open for further replies.

gjorgi

Programmer
Apr 4, 2005
12
0
0
US
Hi,
I would like my script to check for any new files in a folder and open them as soon as they are saved in that folder. Folder is located on another machine and both machines are network connected.
I am not looking for complete solution, just a friendly nudge in the right direction...
 
Take a look at file mtime:
file mtime name ?time?
Returns a decimal string giving the time at which file name was last modified. If time is specified, it is a modification time to set for the file (equivalent to Unix touch). The time is measured in the standard POSIX fashion as seconds from a fixed starting time (often January 1, 1970). If the file doesn't exist or its modified time cannot be queried or set then an error is generated.

Perhaps you can maintain a variable of the time you check the directory (using glob) and query mtime for any files after that time.

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top