rmdir-empty: take directory arguments

This commit is contained in:
neingeist 2023-02-20 15:45:47 +01:00
parent a295c5c0c6
commit 7bc79861e1

View file

@ -1,5 +1,15 @@
#!/bin/sh
# recursively delete empty directories
find . -depth \
-path "." -prune -or \
-type d -empty -exec rmdir -v {} \;
rmdir_empty() {
# make default . explicit
if [ -z "$1" ]; then
set -- .
fi
find "$@" -depth \
-path "." -prune -or \
-type d -empty -exec rmdir -v {} \;
}
rmdir_empty "$@"