Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is a question from a newbie trying to learn UNIX commands.

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.

share|improve this question
up vote 4 down vote accepted

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?

share|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.

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