假設要移除七天前的檔案
find /workdir/logs -type f -mtime +7d | xargs rm -rf {}
定時執行的話,加入crontab即可
-mtime n[smhdw]
If no units are specified, this primary evaluates to true if the
difference between the file last modification time and the time
find was started, rounded up to the next full 24-hour period, is
n 24-hour periods.
If units are specified, this primary evaluates to true if the
difference between the file last modification time and the time
find was started is exactly n units. Please refer to the -atime
primary description for information on supported time units.
全站熱搜
留言列表