bin: adjust rd to always clean empty dirs and files
This commit is contained in:
parent
e9d7ad7305
commit
4d6456054b
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
# Shortcut for mathematical calculations
|
# Shortcut for mathematical calculations
|
||||||
# Assumes german numbers as in 1.000,5
|
# Assumes german numbers as in 1.000,5
|
||||||
calc="$(echo "$@" | sed -e 's/p/+/g' -e 's/\.//g' -e 's/,/./g' -e 's/x/*/g' -e 's/m/-/g')"
|
calc="$(echo "$@" | sed -e 's/p/+/g' -e 's/\.//g' -e 's/,/./g' -e 's/x/*/g' -e 's/m/-/g')"
|
||||||
|
|
|
@ -10,15 +10,16 @@ do
|
||||||
then echo -n "Force delete git project $f? "
|
then echo -n "Force delete git project $f? "
|
||||||
read answer
|
read answer
|
||||||
test "$answer" = "y" &&
|
test "$answer" = "y" &&
|
||||||
$elevate rm -rf "$f"
|
$elevate rm -rf "$f" &&
|
||||||
else
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
$elevate find "$f" -maxdepth $(expr 1 \& "$f" = "/" \| 5 \& $# \> 0 \| 3) -not -name .stfolder \( -type d -o -type f \) -a -empty -printf 'Removing empty %p\n' -delete
|
$elevate find "$f" -maxdepth $(expr 1 \& "$f" = "/" \| 5 \& $# \> 0 \| 3) -not -name .stfolder \( -type d -o -type f \) -a -empty -printf 'Removing empty %p\n' -delete
|
||||||
test $# -eq 0 && exit $?
|
test $# -eq 0 && exit $?
|
||||||
if test -e "$f"; then
|
if test -e "$f"; then
|
||||||
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"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
else $elevate rm -i "$f"
|
else $elevate rm -i "$f"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue