✨ rmdir-empty: do the first level directories first
This commit is contained in:
parent
0f8c9c5b68
commit
ba0030d418
1 changed files with 5 additions and 3 deletions
|
@ -7,9 +7,11 @@ rmdir_empty() {
|
|||
set -- .
|
||||
fi
|
||||
|
||||
find "$@" -depth \
|
||||
-path "." -prune -or \
|
||||
-type d -empty -exec rmdir -v {} \;
|
||||
# do the first level directories first
|
||||
for maxdepth_opt in "-maxdepth 1" ""; do
|
||||
find "$@" -depth -mindepth 1 $maxdepth_opt \
|
||||
-type d -empty -exec rmdir -v {} \;
|
||||
done
|
||||
}
|
||||
|
||||
rmdir_empty "$@"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue