Description: +n is greater than N,-n is less than n, n is equal to N.
Find/-amin-30-ls # finds files accessed in the last 30 minutes of the system
Find/-atime-2-ls # finds files accessed in the last 48 hours of the system
Find/-mmin-10-ls # finds files that have been modified in the last 10 minutes of the system
Find/-mtime-1-ls # finds files that have been modified in the last 24 hours of the system
Find/-cmin-10-ls # finds files that have changed state in the last 10 minutes of the system
Find/-ctime-1-ls # finds files that have changed state in the last 24 hours of the system
# Remove all sub-files from the TMP directory 3 days ago, if not with *, it will kill this non-empty directory
/usr/bin/find/data/htdocs/test.cn/data/tmp/*-mtime +3-ls
[Under normal circumstances: the number of files found by atime and Mtime is equal]
Examples of shell scripts:
File name: test.sh
The contents are as follows:
# deleted three days ago, legacy dump file
day=$ (/bin/date +%y-%m-%d);
Count= '/usr/bin/find/data/htdocs/test.cn/data/tmp/*-mtime +3 | Wc-l ';
/usr/bin/find/data/htdocs/test.cn/data/tmp/*-mtime +3-delete;
Echo $day – $count;
#删除10天前的所有文件
find/tmp/*-type f-mtime +10-exec rm {} \;
#查找10天前的所有文件
find/tmp/*-type f-mtime +10-exec ls-l {} \;
can cooperate with script command, automatically delete android qq 15 days ago Picture cache
find/sdcard/tencent/*/*/.photo/*-type f-mtime +15-exec rm {} \;
Use Shell to delete files from three days ago or three days in Linux