Find mmin X min – is it X min when starting “find” or when “find” find the file

find

Assume, I have about 10,000 files in a folder. I have been using hourly crontab to find files that are modified in the last 60 min then process it.

Invoke find -mmin -60 at 01:00:00

Assume 1st file was modified at 00:00:00 and easily found by "find" at 01:00:00.

Then, assume the 10,000th file was modified at 00:00:00 as well

but now is at 01:10:00 and "find" is still working hard to reach the 10,000th file

So now, at 70min later, will "find" return the 10,000th file that was modified at 00:00:00?

Best Answer

In GNU find, the reference time which is used to evaluate files with -mmin etc. is calculated and stored when the expression is parsed, so in effect when find starts.

This means that all such time comparisons use the same time reference for all evaluated files, the time at which find parsed its command line.

Related Question