I tried all the suggestions in the article: Script that delete files after 5 days
When I run find without the -mtime parameter it finds the files I am looking for. When I add -mtime +2, nothing is returned. I know there are files of the appropriate date(s) in the directory I am looking in with the find command.
1 Answer
From man find:
-atime n
File was last accessed n*24 hours ago. When find figures out how many 24-hour
periods ago the file was last accessed, any fractional part is ignored, so to match
-atime +1, a file has to have been accessed at least two days ago.
-mtime n
File's data was last modified n*24 hours ago. See the comments for -atime to
understand how rounding affects the interpretation of file modification times.
but see also:
-daystart
Measure times (for -amin, -atime, -cmin, -ctime, -mmin, and -mtime) from the
beginning of today rather than from 24 hours ago. This option only affects tests
which appear later on the command line.
In summary, use find -mtime +1 to find 2 day old files.