Remove OSX “._” files from Subversion

Do you use subversion? Did some well meaning OSX-using member of your team do “svn add *”  and accidentially commit a bunch of OSX’s vestigal “._” files?

Here’s an easy way to get rid of them. From the command line (in any Unix variant, including OSX) and cd to the working directory in question. Then paste in the following:

  1. #!/bin/bash
  2.  
  3. for file in \
  4.     `find . -name "._*" -print | grep -v ".svn"`;
  5.   do svn del $file;
  6. done

Then commit, and you’re done.

4 Responses to “Remove OSX “._” files from Subversion”

  1. On February 13th, 2009 at 9:47 am Mark said:

    OS X IS A SAINT. YOU LAY OFF.


  2. On February 13th, 2009 at 7:14 pm Jaybill McCarthy said:

    @Mark – OSX is fine. I’m just cheap.


  3. On February 16th, 2009 at 4:17 pm Rich said:

    What would that script look like in order to delete those files from the filesystem before I add a bunch of folders to SVN?

    Would I just replace “do svn del $file;” with “do rm $file;”?


  4. On February 17th, 2009 at 8:12 am Jaybill McCarthy said:

    @rich – Yes, anything you do in that loop will act on whatever is in $file.


Leave a Reply

Note: If you've never commented on Jaybill.com before, your comment will not be visible immediately. Someone will need to approve it first. After we approve one of your comments (which means we think you're not a robot) all future comments will show up immediately. Please do not post your comment twice.