- Aug
- 29
- 0
I have a script that monitors certain files on a shared network drive that are created & deleted by other processes running on the same or different hosts from the monitoring script.
Because this monitoring script runs independently of the processes that create & delete the files of interest, I've run into a timing issue with the following command:
This indicates to me that the file exists at the time the condition is checked, but is deleted by the time the function can be executed. I've tried to add some redirection to the command (set age=%@fileage["%file"] 2> nul:) to suppress the error, but that doesn't appear to work.
I don't want to suppress the entire batch file's use of STDERR, just the one line where the error condition isn't relevant. Is there some way to make the function "quiet"?
Because this monitoring script runs independently of the processes that create & delete the files of interest, I've run into a timing issue with the following command:
if exist "%file" set age=%@fileage["%file"]
The symptom is that the script line will occasionally throw an error that "The system cannot find the file specified."
This indicates to me that the file exists at the time the condition is checked, but is deleted by the time the function can be executed. I've tried to add some redirection to the command (set age=%@fileage["%file"] 2> nul:) to suppress the error, but that doesn't appear to work.
I don't want to suppress the entire batch file's use of STDERR, just the one line where the error condition isn't relevant. Is there some way to make the function "quiet"?