How to remove .svn files under Windows
One of the common tasks while developing software is removing subversion files. It is a good practice to remove .svn files before sending code to your client to give him clean solution with no additional information on how was your code managed. It is easier for client to manage received code on his own when he doesn’t need to remove .svn files that were left by you.
To remove .svn files just enter this code into a bat file – let’s say
for /f "tokens=* delims=" %%i in ('dir /s /b /a:d *svn') do ( rd /s /q "%%i" )
Next step is to place
remove-svn.bat in the root directory of your project and run it.
If you are interested in what this script does behind the scenes here is the answer.
for /f is a loop command that conditionally performs command against each file item.
delims are the options which specify which numbered item to read and what is the delimiter character from each line.
Next there is a
%%i parameter which represents a file item.
dir command displays a list of files and subdirectories in a directory.
/s argument is set to display files in a directory and subdirectories.
/b is set to for the command to use bare format which doesn’t display heading information or summaries. Next an
/a argument is set with
d option that lists only directories. At the end we have
*svn pattern which specifies what items we want to process.
rd command deletes directory.
/s flag removes all directories and files and a given directory.
/q when set indicates a quiet mode – script doesn’t ask if it’s ok to remove a directory tree.