I was trying to test the rmdir command by removing a test directory located in my Downloads directory. I have read and write rights on Downloads.

I issued rmdir -p /Users/myself/Downloads/test and got rmdir: /Users/myself/Downloads: Permission denied , but the test directory was deleted. So why do I have this message? Should I care?

I'm using OSX Lion 10.7.3.


From man rmdir:

   -p, --parents
          remove DIRECTORY and its ancestors; e.g., `rmdir -p a/b/c' is similar to `rmdir a/b/c a/b a'

So your rmdir call tries to delete test (succeeds), then tries to delete the parent directory Documents (or rather Downloads) and fails... I think. I'd rather have expected some "directory not empty" error, because why shouldn't you have the permissions to delete this folder?

  • Thanks sr_ for your answer. You are right it is "Downloads" not "Documents". Maybe I can't delete "Downloads" because one just can't delete "Downloads" because of a "This folder is required by OS X" thing... – politicus Jun 10 '12 at 13:20
  • Possibly, I don't know anything about how OS X alters the general "UNIX-like"-ness encountered everywhere else. :) – sr_ Jun 10 '12 at 13:31
  • I tried to delete the folder "Sites" via Finder and got that kind of message. – politicus Jun 10 '12 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.