Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I remove missing files with spaces in svn?

Tags:

bash

svn

I have this snippet I found.

svn status | grep '\!' | awk '{print $2;}' | xargs svn rm 

It removes all missing files, if I or someone deletes the files manually (via the editor or they are deleted via the system)

But my bash coding is not great, what it's missing is that it does not work with files that have spaces in it.

svn rm Super\ Test.file

Is the correct way to remove files with a space, but I don't know how to modify the snippet above so it works. (or if you have another snippet that does)

like image 594
Ólafur Waage Avatar asked May 12 '09 13:05

Ólafur Waage


People also ask

How to Delete files from Tortoise svn?

Use TortoiseSVN → Delete to remove files or folders from Subversion. When you TortoiseSVN → Delete a file or folder, it is removed from your working copy immediately as well as being marked for deletion in the repository on next commit. The item's parent folder shows a “modified” icon overlay.

What is svn delete?

svn delete (del, remove, rm) — Delete an item from a working copy or the repository.


2 Answers

svn status | grep '^\!' | cut -c8- | while read f; do svn rm "$f"; done
like image 150
cadrian Avatar answered Sep 28 '22 02:09

cadrian


You could 0 escape and use the -0 flag to xargs.

svn st | awk '/^!/ { sub("^! +", ""); printf "%s\0", $0 }' | xargs -0 svn rm

This has another advantage in that files with quotes or other special characters will not screw up the xargs command line either.

like image 29
richq Avatar answered Sep 28 '22 02:09

richq