bin: improve empty folder deletion
This commit is contained in:
parent
1337e49e6d
commit
695a31f19e
|
@ -18,10 +18,10 @@ for f in ${_clean_folders[@]}
|
||||||
do "$local" >/dev/null 2>&1 && f="$(echo "$f" | sed "s|$HOME|$($loc)|")"
|
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
|
test -f $f || test -d $f && echo $f && rm -rf $i $f
|
||||||
done
|
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"
|
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
|
for k in "${!_clean_map[@]}"; do
|
||||||
folder="${_clean_map[$k]}"
|
folder="${_clean_map[$k]}"
|
||||||
|
|
|
@ -10,7 +10,7 @@ do
|
||||||
read answer
|
read answer
|
||||||
test "$answer" = "y" &&
|
test "$answer" = "y" &&
|
||||||
$elevate rm -rf "$f"
|
$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" &&
|
test -e "$f" &&
|
||||||
echo -n "$f ($(ls -A $f | head -3 | paste -s -d' ')) " >&2 &&
|
echo -n "$f ($(ls -A $f | head -3 | paste -s -d' ')) " >&2 &&
|
||||||
$elevate rm -rI "$f"
|
$elevate rm -rI "$f"
|
||||||
|
|
Loading…
Reference in New Issue