We create a Windows-based application that recursively moves the directory structure, searches for files that match certain criteria, and then does some processing on them. To decide whether to process a particular file, we must open that file and read its contents.
This approach seems fundamental, but some clients testing the earlier version of the application reported that it changes the access time of a large number of their files (not surprising, since it actually accesses the files). This is a problem for these clients because they have archive policies based on files with the last access (for example, they archive files that were not available in the last 12 months). Since it is planned to launch our application more often than the โwindowโ of the archive, we effectively prevent the archiving of any of these files.
We tried to add code to save every time I last accessed a file before reading it, and then writing it later (disgusting, I know), but this caused problems for another client that did incremental backups based on the file system transaction log, Our explicit setting of the time of the last access to files led to the fact that these files were included in each incremental backup, even if they did not actually change.
So, here is the question: is there any way in the Windows environment that we can read the file without updating the last time?
Thanks in advance!
EDIT: Despite the ntfs tag, we actually cannot rely on the file system, which is the NTFS file system. Many of our clients run our application over the network, so anything can be on the other end.
source share