We have a scans folder that used to maintain all scans and I would periodically go in and delete the files out.
Now I need to clean it out every 20 minutes. I have a scheduled task in Windows 2003 Server that runs every 20 minutes and deletes everything out of the folder. The issue is that if someone scans in a document at 10:19, at 10:20 it will be deleted. My users were informed of this but they didn't "get it" and are now complaining that the files are being deleted before they have a chance to get back to their desk.
Is it possible to delete files that are older than 20 minutes and not delete the ones that are newer than 20 minutes? I know there is a /tc command for DOS that will tell you the timestamp of when the file was created, but I need to know how to use that information in my delete statment.
Does anyone know how to do this?
I was thinking that I would copy the files into an archive folder then delete them. This would give them 20 more minutes just in case they got busy. I will tell it to automatically overwrite the files inside the Archive folder.
Below is the code I have so far, and it is working; but not deleting files older than 20 minutes; just copying and purging.
Any help is appreciated.
xcopy *.pdf D:\Documents\Public\Scans\archive /y