Skip to main content

Posts

Showing posts from May, 2012

Find files and do something with them

Find removed (deleted) files still in use via /proc: # find -L /proc/*/fd -links 0 2 > /dev/null Remove .svn folders recursively. (I have seen solutions using the - exec switch, but it is too slow, so I use find's own delete option here) $ find . -name ".svn" -type d -delete; Find and delete files with multiple choice of names: $    find /path -name '.DS_Store' -or -name '._*' -delete  Finding file in .h with "raoul" in it ( the "-n" is for displaying line number ): $    find /path -name "*.h" | grep -n "raoul" Find empty folders: $    find /path -type d -empty Find empty folder and list: $    find /path -type d -empty -ls Find empty folder and save result in temporary file: $    find /path -type d -empty -fls /path/to/tempfile.txt