Skip to Content
gnux

-p, --parents

Remove DIRECTORY and its ancestors; e.g., 'rmdirx -p a/b/c' is similar to 'rmdirx a/b/c a/b a'.

An option of rmdirx.

Usage

rmdirx -p DIRECTORY...
rmdirx --parents DIRECTORY...

Details

ShortLongValueDefaultMeaning
-p--parentsnoneremove DIRECTORY and its ancestors; e.g., 'rmdirx -p a/b/c' is similar to 'rmdirx a/b/c a/b a'

Examples

Remove a directory and its now-empty parents, reporting each

rmdirx -pv out/reports/2024

Remove a chain of parents and confirm the top one is gone

rmdirx -p x/y/z && echox 'x is gone'

Prune parents as far as they are empty, stopping quietly at the first that is not

rmdirx -p --ignore-fail-on-non-empty keep/sub

Create and then remove a temporary staging tree with the gnux shell

gnux shell -c 'mkdirx -p staging/a && rmdirx -pv staging/a'

Help in the terminal

gnux help rmdirx --parents

On this page