The use of this parameter for Find-mtime has more pits, which is recorded here today:
The Mtime parameter should be understood as follows:
-mtime N to find the file according to the file change time, n is an integer.
- n indicates a file change time distance of n days
- -N means file change time is less than n days
- +n indicates file change time distance before n days
Cases:
- -mtime 0 represents files that are currently 0 days away from the file modification time, which is less than 1 days (24 hours) away from the current time.
- -mtime 1 represents a file modified from a file that is currently 1 days long, that is, 1 days (24 hours-48 hours) from the current time.
- -mtime+1 indicates file modification time is greater than 1 days, that is, 2 days (48 hours) away from the current time file
- -mtime-1 indicates file modification time is less than 1 days files, that is, 1 days (24 hours) from the current time
Why does-mtime+1 mean that files are modified for files greater than 1 days, that is, files that are 48 hours away from the current time, not 24 hours? Because the N value can only be an integer, that is, the nearest integer greater than 1 is 2, so-mtime+1 is not greater than the current time of 1 days (24 hours), but is greater than the current time of 2 days (48 hours).
The-mtime parameter in the Find command of the Linux command