Tips for ‘FIND’ command
#find all files under /dir older than 7 days, and delete
find /dir -type f -mtime +7 | xargs rm -f
#find all files newer than FILE, and delete
find /dir -type f -newer /path/to/FILE -exec rm \{\} \;
#find all files older than 10 minutes, and print names(print is default)
find /dir -type f -mmin +10 -print
#find all files newer than 1 day, and tar them to file.tar
find /dir -type f -mtime -1 | tar -c -T – -f file.tar
About this entry
You’re currently reading “Tips for ‘FIND’ command,” an entry on Git4 Gembir4 g4l4U g40L
- Published:
- August 28, 2008 / 7:45 pm
- Category:
- Shell
- Tags:

1 Comment
Jump to comment form | comment rss [?] | trackback uri [?]