Я испробовал все предложения в статье: Скрипт, который удаляет файлы через 5 дней.
Когда я запускаю find без параметра -mtime
, он находит нужные мне файлы. Когда я добавляю -mtime +2
, ничего не возвращается. Я знаю, что в каталоге, в котором я просматриваю команду find
, есть файлы с соответствующей датой.
Из 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.
, но также смотрите:
-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.
Таким образом, используйте find -mtime +1
, чтобы найти 2-дневную давность. файлы.