After removing unneeded files appropriate empty directories

are also removed
TODO: one task done
This commit is contained in:
Aleksey Cheusov 2009-06-08 11:24:49 +00:00 committed by Thomas Klausner
parent e8d098732b
commit 90f8eef7cf
2 changed files with 8 additions and 4 deletions

View file

@ -3,7 +3,6 @@ TODO list and thoughts
existing tools:
pkg_cleanup_distdir:
- remove empty directories
pkg_cmp_summary:
- test for -m

View file

@ -98,9 +98,14 @@ awk '$1 == 2 {print $2}' > "$rm_file"
if test -n "$delete"; then
xargs rm -f < "$rm_file"
find . -type d |
while read d; do
rmdir "$d" 2>/dev/null || true
sed 's,/[^/]*$,,' "$rm_file" | sort | uniq |
while read -r dir; do
while test "$dir" != '.'; do
if ! rmdir "$dir" 2>/dev/null; then
break
fi
dir=`dirname $dir`
done
done
else
cat "$rm_file"