найти -mtime не работает

Я испробовал все предложения в статье: Скрипт, который удаляет файлы через 5 дней.

Когда я запускаю find без параметра -mtime, он находит нужные мне файлы. Когда я добавляю -mtime +2, ничего не возвращается. Я знаю, что в каталоге, в котором я просматриваю команду find, есть файлы с соответствующей датой.

0
задан 10 October 2019 в 21:33

1 ответ

Из 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-дневную давность. файлы.

1
ответ дан 10 October 2019 в 21:16

Другие вопросы по тегам:

Похожие вопросы: