How to recursivley and permanently ignore bin and obj folders from a subversion (svn) repository
This is primarily focused at those of us on Windows but should work in a *nix world to.
A quick recap on ignores in subversion
There are a couple of methods to ignore files in an svn repo.
- Most people know of the global ignore list and it’s accessibility through the likes of TortoiseSvn but this is client side and commiters without the correct list configured locally can still commit the dreaded /bin and /obj folders.
- The preferred way is to permanantly set an svn property, the one we’re particulalry interested in is svn:ignore, this will enforce ignoring of all marked folders or files for every single client commit.
Both of these methods result in the same action at the client, reducing that ridiculous long list of untracked files when you select ‘Add to repository’, the latter is by far the most effective way of doing this.
## What do we need to ignore and delete?
There are generally a couple of scenarios we need to tackle when tidying up an svn repository to remove/ignore a large quantity of folders and files.
- Ignore any untracked bin or obj folders
- Remove any tracked bin or obj folders
- Ignore any tracked bin or obj folders
Scenarios 1 and 3 are solved easily with the second method above, I’ve found the 2nd scenario to undoubtedly be a little manual, the most effective way I have achieved this is to use the [TortoiseSvn add to ignore list ]() approach, which marks the folder for delete from the repository and sets the svn:ignore property.
Install an svn client console
Unfortunately for any recursive actions on a large number of folders/files TortoiseSvn is too granular and not your friend, by all means feel free to click navigate through every folder you would like to premanently ignore by [doing wha I mentioned above]() but personally I only use that for the specific scenario where files are already tracked.
I use the SlikSvn client as it’s kept up to date and comes with an MSI that does everything installing wise, including updating your PATH, either way you need to install a client to achieve the below.
Report on existing svn:ignore properties
Navigate to the top level of your svn repository, in my case this was trunk, and run the following command:
[code language=”bash”]svn propget svn:ignore -R[/code]
The above will list out all existing svn:ignore properties, this could be huge or contain very little or nothing.
[code language=”bash”]svn propset svn:ignore bin . -R[/code]