Content added Content deleted
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
<man>find</man> |
<man>find</man> |
||
Line 21: | Line 19: | ||
/dir/file |
/dir/file |
||
<pre> |
|||
EXAMPLE : find /var/log/ -name "20*-*-*_*.log*" -mtime +80 -exec rm {} \; |
EXAMPLE : find /var/log/ -name "20*-*-*_*.log*" -mtime +80 -exec rm {} \; |
||
deletes all files older than 80 days |
deletes all files older than 80 days |
||
</pre> |
Revision as of 12:23, 23 April 2008
<man>find</man>
Tips
If you want to suppress error messages such as
find / -name file find: cannot read dir /lost+found: Permission denied /dir/file
as these messages are written to errout and not stdout, a nice trick is to pipe errout to null
find / -name file 2> /dev/null /dir/file
EXAMPLE : find /var/log/ -name "20*-*-*_*.log*" -mtime +80 -exec rm {} \; deletes all files older than 80 days