bin: improve empty folder deletion

This commit is contained in:
xeruf 2021-12-09 12:27:33 +01:00
parent 1337e49e6d
commit 695a31f19e
2 changed files with 3 additions and 3 deletions

View File

@ -18,10 +18,10 @@ for f in ${_clean_folders[@]}
do "$local" >/dev/null 2>&1 && f="$(echo "$f" | sed "s|$HOME|$($loc)|")"
test -f $f || test -d $f && echo $f && rm -rf $i $f
done
find "$dir" -maxdepth 2 -not -name ".stfolder" -empty -exec rm -vd {} +
find "$dir" -maxdepth 2 -not -name ".stfolder" -empty -printf "Removing empty %p\n" -delete
highlight "e to recursively remove empty folders and files"
[[ $1 =~ "e" ]] && find -empty -type d -exec rm -vd {} +
[[ $1 =~ "e" ]] && find -empty -not -name ".stfolder" -empty -printf "Removing empty %p\n" -delete
for k in "${!_clean_map[@]}"; do
folder="${_clean_map[$k]}"

View File

@ -10,7 +10,7 @@ do
read answer
test "$answer" = "y" &&
$elevate rm -rf "$f"
else find "$f" -maxdepth 4 -empty -printf "Removing empty %p\n" -delete
else find "$f" -maxdepth 4 -not -name ".stfolder" -empty -printf "Removing empty %p\n" -delete
test -e "$f" &&
echo -n "$f ($(ls -A $f | head -3 | paste -s -d' ')) " >&2 &&
$elevate rm -rI "$f"