Find files/dirs recursively and do something

The following will find all files in the current directory and all of current subdirectories matching .git* and delete them:

sudo find ./ -type f -name '.git*' -exec rm  {} \;

The following will find all directories named .git in the current dir and subdirs and delete them:

sudo find ./ -type f -name .git -exec rm  {} \;

Notice how you escape the asterisk by including it within a pair of single quotes.

0 komentar:

Posting Komentar