rm on cygwin, cannot unlink not owner

1

I need to delete all files/dirs named .svn using rm on cgywin

drwxr-xr-x    6      4096 Oct 26 15:33 .svn

$ rm -d .svn
rm: cannot unlink `.svn': Not owner

user15586

Posted 2009-10-27T01:37:17.753

Reputation: 627

Answers

1

If you are the adminsitrator on your machine, ownership is a concept that shouldn't concern you much.

Do chmod u+w .svn, then try your remove again.

DaveParillo

Posted 2009-10-27T01:37:17.753

Reputation: 13 402

not sure that'll work on cygwin. may need cacls (if administrator) to get permissions on the file. – quack quixote – 2009-10-27T05:18:47.920

@~quack. Thanks - You may be right - I think there is a dependency with the CYGWIN environment variable (http://www.cygwin.com/cygwin-ug-net/using-cygwinenv.html) I may have forgotten about.

– DaveParillo – 2009-10-27T22:56:30.687

The CYGWIN variable needs to include a setting for ntea (NT Extended Attributes). This should be done in the file cygnus.bat. Add the following line in the file: export CYGWIN=ntea – DaveParillo – 2009-10-27T23:01:08.837

good find, but actually i think you want ntsec not ntea (same link, further down the page), to get real permissions instead of faked. more here: http://www.cygwin.com/cygwin-ug-net/ntsec.html ...

– quack quixote – 2009-10-28T04:53:23.343

3

super-user (root) is the only account able to use rm -d flag


From the rm man page

-d, --directory

      unlink FILE, even if it is  a  non-empty  directory  (super-user
      only; this works only if your system supports ‘unlink’ for 
          nonempty directories)

You will need to su root or something similar before using rm -d

Have you tried rm -rf /full/path/to/dir or (if empty) rmdir /full/path/to/dir ?

Jeremy W

Posted 2009-10-27T01:37:17.753

Reputation: 3 529

+1 for rm -rf. – paulroho – 2014-09-19T19:11:41.667