How do you recursively delete all hidden files in a directory on UNIX?

find . -name ".*" -print

I don’t know the MAC OS, but that is how you find them all in most *nix environments.

find . -name ".*" -exec rm -rf {} \;

to get rid of them… do the first find and make sure that list is what you want before you delete them all.

The first "." means from your current directory. Also note the second ".*" can be changed to ".svn*" or any other more specific name; the syntax above just finds all hidden files, but you can be more selective. I use this all the time to remove all of the .svn directories in old code.

Leave a Comment