简体   繁体   中英

Why can't I delete the entries file in a .svn directory from the command line?

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 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.

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.

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

应该

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

我也必须取消设置uappnd标志和uchg标志,即:

find .svn -type f |xargs sudo chflags nouappnd,nouchg

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