Tuesday, July 12, 2005

find files in UNIX, Delete Old files, find files based on modified time

Find a file with given name
find /home/chaganlal -name core

Find files larger than 1MB
find /home/chaganlal -size +1000000c -print


Find files larger than 10 KB, but less than 32 KB
(The . denotes current directory)
find . -size +10000c -size -32000c -print

Find files that were modified less than 8, more than 6 days ago
find . -mtime +6 -mtime -8 -print

Find files that were modified exactly 7 days old
find . -mtime 7 -print

Find files that were last accessed more than 30 days ago
find . -atime +30 -print

To delete files older than 200 days
find /home/chaganlal/ -mtime +200 -exec rm {} \;

0 Comments:

Post a Comment

<< Home