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

前端 未结 1 1502
挽巷
挽巷 2021-02-05 10:18

With the new iPhone 2x files i\'ve stumbled uppon this problem...

1条回答
  •  迷失自我
    2021-02-05 11:05

    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 (i.e. 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

    0 讨论(0)
提交回复
热议问题