[Linux 常用技巧] shell删除定制日期以前的文件
转载本站文章请注明,转载自:扶凯[http://www.php-oa.com]
本文链接: http://www.php-oa.com/2008/03/01/shellshanchudingqiyiqiandewenjian.html
因为我的日志名字每天不一样,写了个shell删除6天以前的文件
#vim del.sh
#!/bin/bash
find /var/log/ -mtime +6 |xargs rm -rf
转载本站文章请注明,转载自:扶凯[http://www.php-oa.com]
本文链接: http://www.php-oa.com/2008/03/01/shellshanchudingqiyiqiandewenjian.html
因为我的日志名字每天不一样,写了个shell删除6天以前的文件
#vim del.sh
#!/bin/bash
find /var/log/ -mtime +6 |xargs rm -rf
不错…
今天我又发现了一个find的用法.
find /var/log/ -mtime +6 -exec rm -vrf {} +