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…
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 filenameto set it. Orchflags nouchg filenameto 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.