This is more of a methodology question than a technical one. I am taking over and re-writing an old VB script for a customer. The customer uses a network share mapped to T:\ as a temporary space for users to drop files and folders internally, with the understanding that anything older than 2 days will automatically be deleted. There have been complaints for years from employees who would copy a file or folder out to this share only to find it gone the next day. In looking over the vbscript I see it is using the file object’s DateLastAccessed attribute to determine whether it is eligible for deletion.
I have found, however, a number of files that, when COPIED to the directory, retain all three of the original attributes (in PS parlance): CreationTime, LastWriteTime, and LastAccessTime so long as they are not opened (shortcuts for example). Others update the CreationTime when copied. I found as well that if a file is right click, dragged and MOVED to this temp directory none of these are updated, but they are if it is MOVED from the temp directory back to the local machine.
In essence, I’m just curious if anyone has dealt with this, or has any ideas. If I go with just last access time, I could be grabbing files that have only been in the temp directory for a short time (perhaps only minutes before the daily job runs) which is their current issue. My only thought is to grab all three attributes and check if any of them fall between the time the job last run and the current time, and try to deduce from there, but was hoping there was an easier way.