DOS Batch file: Script to display message based on file date
Posted on 2010-09-01
Using a DOS batch file (.bat) I am looking to display a message on the screen (or execute a program of my choosing) if a file, located on a network share, was modified earlier that today's date.
Here is what's going on:
Every night, at midnight, a server outputs data to a text file in a network share; for example \\server\share\output.txt
Other users access this file to retrieve needed data
To ensure they get the data they need, I have to ensure the text file was created at, or after, midnight.
I do this by looking at the file's Modified Date. If it's the same as today's date, I know it has current data.
In very loose programming syntax, I would like it to do this:
If \\server\share\output.txt = todays date
display "Error" on screen (or execute a program of my choosing)