SVN: how to clean up a directory from unversioned files

Here is the command to delete all the files in a SVN directory that are not in the SVN server repository.

The first part (svn status) returns all files with the ? tag (meaning they don’t belong to the repository). The –no–ignore should be used if you have some set some files to be ignored in your SVN configuration file.

The “grep” command is used to deal with the question tag.

finally, the “xargs ” commands perform the cleanup.

Be aware that the final option “-rf” means delete directories and don’t have for confirmation so to be used with care !!!

svn status --no-ignore | grep '^\?' | sed 's/^\?     //'  | xargs rm -rf
Please follow and like us:
This entry was posted in Linux and tagged . Bookmark the permalink.

One Response to SVN: how to clean up a directory from unversioned files

Leave a Reply

Your email address will not be published. Required fields are marked *