Posts Tagged ‘svn’

Removing the SVN metadata files (.svn/) in Linux

If you ever want to remove a folder from SVN control (clean the folder by removing the .snv metadata folders) in Linux, you can simply run the following command:

rm -rf $(find path/to/the/CORRECT/folder -type d -name .svn)

where:

  • rm -rf is remove recursive force. Recursive for deleting the directories and their contents recursively and force for no prompting (for example, for write protected files)
  • $(..) is the command substitution, that takes the output of a command and uses it as input for another
  • find path/to/the/CORRECT/folder -type d -name .svn is searching (recursively) for folders (d for directory) with the name .svn1 in the directory pointed by path/to/the/CORRECT/folder

Be careful to use the correct path, else you can remove the svn metada for the wrong folder! A good approach can be to execute the find command without the rm, check the output, and then proceed to the remove :-).

1case sensitive, use -iname for insensitive