One of the missions of an export tool I have in my application, is to clean all .svn
directories from my application directory tree. I am looking for a recursiv
If you don't like to see a lot of
find: `./.svn': No such file or directory
warnings, then use the -depth
switch:
find . -depth -name .svn -exec rm -fr {} \;
Try this:
find . -name .svn -exec rm -v {} \;
Read more about the find command at developerWorks.
Try this:
find . -name .svn -exec rm -rf '{}' \;
Before running a command like that, I often like to run this first:
find . -name .svn -exec ls '{}' \;
In Windows, you can use the following registry script to add "Delete SVN Folders" to your right click context menu. Run it on any directory containing those pesky files.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN]
@="Delete SVN Folders"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN\command]
@="cmd.exe /c \"TITLE Removing SVN Folders in %1 && COLOR 9A && FOR /r \"%1\" %%f IN (.svn) DO RD /s /q \"%%f\" \""
No need for pipes, xargs, exec, or anything:
find . -name .svn -delete
Edit: Just kidding, evidently -delete
calls unlinkat()
under the hood, so it behaves like unlink
or rmdir
and will refuse to operate on directories containing files.
You almost had it. If you want to pass the output of a command as parameters to another one, you'll need to use xargs. Adding -print0
makes sure the script can handle paths with whitespace:
find . -type d -name .svn -print0|xargs -0 rm -rf