Search code examples
svnunixshellscriptingcygwin

XArgs command on cygwin is mangling file paths


I'm trying to use xargs on a Cygwin Windows system to remove SVN files deleted locally.

I run the following command that generates the following output:

svn status | grep '^\!' | sed 's/! *//' 

weblings-webplatform\vendor\jetty-7.0.0.pre5\contexts-available\test-annotations.d\META-INF\MANIFEST.MF weblings-webplatform\vendor\jetty-7.0.0.pre5\contexts-available\test-annotations.d\WEB-INF\jetty-env.xml

Then when I run the following command I get the following errors:

 svn status | grep '^\!' | sed 's/! *//' | xargs -I% svn rm %


svn: 'weblings-webplatformvendorjetty-7.0.0.pre5contexts-availabletest-annotations.dMETA-INFMANIFEST.MF' does not exist

I've tried using cygpath to convert the svn status paths but it doesn't appear to do anything.


Solution

  • Using cygpath to change the paths to unix format should work I think.. '\' is an escape character in the linux world, looks like xargs handles it like one. Something like:

    svn status | grep '^\!' | sed 's/! *//' | cygpath -m | xargs -I% svn rm %