Delete SVN files in Linux or Windows
Sometimes you checkout a recent API source code via some SVN client to your local system and thereafter want to remove SVN files from the directory structure. Here are the different ways to remove SVN files from your linux or windows directories:
In Linux here is a simple way:
find . -name '.svn' -type d | xargs rm -rf
This searches for all directories which have svn related files. This is a useful command, but might not work as expected if there are hundreds of thousands files on the server. In this case the following command may be useful:
find . -name .svn -prune -exec rm -rf {} \;
For Windows, i know of three different ways to delete svn files.
Way 1 :Using SVN remove command (cmd)
Create a removeSVN.cmd file in the root directory (of which files you need to delete) having the following lines of code in it:
for /f "tokens=* delims=" %%i in ('dir /s /b /a:d *svn') do (
rd /s /q "%%i"
)
Now navigate to directory like C:/path/to/directory (using command prompt; how to use command prompt) and type removeSVN and press enter. All SVN files from directory should delete now. Alternately, you can simply navigate to root directory in command prompt and paste above lines as a single line [for /f "tokens=* delims=" %%i in ('dir /s /b /a:d *svn') do (rd /s /q "%%i")] and press enter. Files should delete.
Way 2 : Creating a registry entry
Create a registry file anyname.reg and paste the following code in it:
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\" \""
(Note:Make sure that last line is in a single line)
Double click on the reg file you just created and agree to everything it asks you for.
Now, right click on the folder you want to delete SVN from and you should see “Delete SVN Folders/files” on the context menu something like this:
Click on the option shown and all SVN files / folders should delete.
Way 3: Search and delete manualy
Right click on the folder name and click Search..
Enter .svn as the filename to search for.
Click “More advanced options” and select:
- Search hidden files and folders
- Search subfolders
Press search button and delete the folders you find appropriate.
(Note: The search critriea may vary in different versions of Windows. Just take note of the thing you want to do exactly.)
Happy SVN deleting!
Possibly Related posts:
- Finding files using ‘find’ command in Linux
Here’s a list of most useful linux “find files” commands i have summarized recently. Finding files with filename Find file by exact name $ find... - Show hidden files and folders not working in window xp?
I tried to enable “show hidden files and folder” option in my window xp but after clicking “apply” and “ok” when i returned back to... - Windows keyboard shortcuts (hot keys)
This post lists keyboard shortcuts that you can use with Windows. I have picked it from Microsoft website for my personal reference. You too can... - Creating Show Desktop icon on quick launch bar in windows xp
Today i saw my show desktop icon was gone off my quick launch bar automatically. I looked around and came up with a simple solutions.... - A possible fix for file saving permission issues on Windows
You might face permission problems while editing and saving some system files on Windows. While searching something over there i found this information as a...
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.







I really like this! Works way better then windows 7 search and delete.
Great stuff!!