Quick question, how do I recursively remove files of a specific extension? I wish to remove all .svn folders from a project.
rm -Rf www/ "*.svn"
The above seems to remove everything. Im using FreeBSD.
Thanks
Quick question, how do I recursively remove files of a specific extension? I wish to remove all .svn folders from a project.
rm -Rf www/ "*.svn"
The above seems to remove everything. Im using FreeBSD.
Thanks
Ensure that you are happy with the list first.
find www -name '.svn' -type d -ls
Restrict to directories. SVN always names them .svn
.
find www -depth -name '.svn' -type d -exec rm -rf {} \;
I like to use the xargs command, i find it more intuitive, so:
find www -name '.svn' -type d -print0 | xargs -0 rm -r
if you want to remove .svn folders, if you are interested in deleting files:
find www -name '.svn' -type f -print0 | xargs -0 rm
or you can remove everything:
find www -name '.svn' -print0 | xargs -0 rm -r
if you want to be sure of what you will delete, launch the find command without the xargs :-)
good luck!
chdir to the the working directory and run:
find . -iname '.svn' -exec rm -fr {} \;
OR you can specify the path directory like this:
find path -iname '.svn' -exec rm -fr {} \;
By typing :
rm -Rf www/ "*.svn"
You ask to remove the www folder and every *.svn files.
What you certainly want is to remove every *.svn inside the www folder, so you should use:
rm -Rf www/*.svn
(without the space)
not sure if this is the best way to get rid of a repository, but this should do what you need:
find www -name "*.svn" -exec rm -rfv {} \;
Update: here is a nice description of BSD's find
.