rmdir - remove empty directories
$ rmdir `[directory...]`
Remove given directory(ies)
, if they are empty
-p
, --parents
: Remove all directories in each given path-v
, --verbose
: List each directory as it is removeddirectory
: directory(ies) to remove# Try to remove non-empty directory
$ mkdir serenity ; echo cool > serenity/cool.txt
$ rmdir serenity
rmdir: Directory not empty
# Remove empty directory
$ mkdir example
$ ls -a example
. ..
$ rmdir example
$ ls -a example
example: No such file or directory
# Removes foo/bar/baz/, foo/bar/ and foo/
$ rmdir -p foo/bar/baz/