Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

Yeah - I'm definitely not going to risk testing that out myself. ;)

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

It does precicely what it says: it attempts to remove all the directories in the path that you give to it.

If you give it an absolute path, it will attempt to remove all the way back to root, so make sure you give it a relative path.

share|improve this answer
    
Oh interesting - so there are concrete differences between absolute and relative paths. If it removes absolute paths, then will it also remove all of the descendants of each of its ancestors too? So if I gave it an absolute path, would it also remove /bin, /usr, /var, and /etc? –  InquilineKea Oct 5 '11 at 20:01
2  
Only if those directories are empty. rmdir will only remove empty directories. –  James Sneeringer Oct 5 '11 at 20:18
    
@InquilineKea There isn't really anything special about using an absolute path, it's just going to treat root as one of the things you want to delete -- it's equivalent to running rmdir /a/b/c /a/b /a /. So even if /a/b/c actually existed, it would fail when it got to removing /, since other directories still exist (you'd get "Directory not empty") –  Michael Mrozek Oct 5 '11 at 20:19
add comment

Your Answer

 
discard

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.