简体   繁体   中英

How to remove a file with @ in it's name from svn in command line?

有了新的iPhone 2x文件,我偶然发现了这个问题......

You need to add a "@" sign in the end to get SVN to process the file.

For example, if you had a file called foo@2x.png which you want to add to SVN, you would type:

svn add foo@2x.png@

If you have lots of files with the "@" symbol in their name that you want to process in a batch (ie use * wildcard), you can do something like this in OS X Terminal:

find . -name "*@*" | xargs -I % svn add %@

The above command will use the find utility to list out each file with @ in its filename and then pipe each filepath to SVN using XARGS.

For each filepath , XARGS will execute the provided command svn add %@ , except that -I % tells XARGS to replace each occurrence of "%" in the provided command , with the filepath piped. XARGS effectively appends the special "@" at the end of the filename.

For example, after replacing the "%" character, XARGS will execute svn add path/to/your/file@2x.png@ ; SVN will accept this (presumably because SVN looks for the last occurrence of "@" and treats this as a revision specifier)

Hope this helps - I had to whack my head for a bit to add the gazzilion @2x.png files that were needed for my app to be upgraded for iOS4.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM