|
/Admin/commandLine:
Find & process files & directories
Find files ending in ".db", in and below the current directory:
find . -name "*.db" -print | xargs /bin/ls -al
find . -name "*.db" -print | xargs /bin/rm -f
Files last modified more then thirty days ago, in a specified directory:
find /home/userid/trash_* -mtime +30 -type f -exec rm -rf {} \;
Remove empty directories:
find /path/to/base/directory -type d -empty -delete
Find files with a particular name:
find . -type f -name "*unison.tmp-bad" -exec ls -alht {} \; | less
Calculate the size of files found by "find":
find . -type f -name "*unison.tmp-bad" -exec ls -l {} \; | awk '{ s+=$5 } END { print s }'
posted at: 07:22 | path: /Admin/commandLine | permanent link to this entry