I am writing a cleaning function for our software that deletes all image files that have not been used for a month. To do this, I check two things:
- file last modified date
- A query in the database that shows recently viewed files.
The request is much slower than checking the file. Therefore, I would ideally like to be able to reset the last modified date on any files that did not pass the first check, but transfer the second, so that (for example) a list of venerable but often used files will not gradually increase the loading capacity of the management system.
Is there any way to do this without using some kind of coarse (and possibly even slow), for example, renaming each file to a timestamp, and then itself?
source share