Gnu/coreutils/rmdir-invocation
Next: unlink invocation, Previous: readlink invocation, Up: Special file types [Contents][Index]
12.7 rmdir: Remove empty directories
rmdir removes empty directories. Synopsis:
rmdir [option]… directory…
If any directory argument does not refer to an existing empty
directory, it is an error.
The program accepts the following options. Also see Common options.
- ‘
--ignore-fail-on-non-empty’ Ignore each failure to remove a directory that is solely because the directory is non-empty.
- ‘
-p’
‘--parents’ Remove
directory, then try to remove each component ofdirectory. So, for example, ‘rmdir -p a/b/c’ is similar to ‘rmdir a/b/c a/b a’. As such, it fails if any of those directories turns out not to be empty. Use the--ignore-fail-on-non-emptyoption to make it so such a failure does not evoke a diagnostic and does not causermdirto exit unsuccessfully.- ‘
-v’
‘--verbose’ Give a diagnostic for each successful removal.
directoryis removed.
See rm invocation, for how to remove non-empty directories (recursively).
An exit status of zero indicates success, and a nonzero value indicates failure.