tags:

views:

95

answers:

3

First this is all done on Mac OS X, ver 10.6.4

I copied a file tree, which included some java code that had been checked out of subversion. I wanted to delete all the .svn files in that tree. So I used the following command:

find . -name .svn -exec rm -fr .svn {} \;

And I got messages like this:

rm: ./repository/entity/.svn: Directory not empty

I looked in the directory and it looks like this:

$ ls -ld .
-r--r--r--  1 tgia  staff  1250 Aug 13 10:48 entries

And the parent directory for that file looks like this:

$ ls -ld .
drwxr-xr-x  4 tgia  staff  136 Aug 20 16:55 .

ok, change the permissions on the file:

$ chmod u+w entries 
chmod: Unable to change file mode on entries: Operation not permitted 

I don't get it, what's up with these files? Nothing I try with chmod seems to change the file permissions. The file ownership is correct. I am tgia. WTF? Even root can't change them.

$ sudo chmod u+w entries
Password:
chmod: Unable to change file mode on entries: Operation not permitted

Luckily root can delete them...

+1  A: 

I'm not sure your command line is exactly correct. Try:

find . -name .svn | xargs rm -rf

I think your command line will try to execute commands such as:

rm -fr .svn subdir1/.svn
rm -fr .svn subdir2/.svn

That is, you've got an extra .svn in there.

Greg Hewgill
+1  A: 

find . -name .svn -exec rm -fr .svn {} \;

should be

find . -name .svn -exec rm -fr {} \;

Bertrand Marron
Yeah, actually I mistyped, the command I used was find . -name .svn -exec rm -fr {} \;and that wouldn't delete the entries...It was only when I got to the point where I was deleting the files named entry as root that it worked. Very odd.
Tony Giaccone
A: 

I addition to the usual rwx flags, OSX has a special UCHG flag. This may be what you ran into.

In the user interface you can set or unset it in the Get Info window. Click on the "Locked" checkbox.

On the command line use chflags uchg filename to set it. Or chflags nouchg filename to unset.

Files with the read-only flag set on Windows will show up with the uchg flag set when exchanged via smb. That's how I ran into it.

dar512