diff --git a/bin/sde-cleanup-download b/bin/sde-cleanup-download index b32b89c..3fe21e9 100755 --- a/bin/sde-cleanup-download +++ b/bin/sde-cleanup-download @@ -18,17 +18,60 @@ . $SDEROOT/lib/libsde.in +cleanup_usage() { + local progname=${0##*/} + cat < "$tmpfile" +# get list of accepted files +cat < "$tmpfile" +download/mirror +download/local +EOT +. $SDEROOT/bin/sde-list-download >> "$tmpfile" # and check those I have against that list ( cd "$SDEROOT"; find download/ -type f ) | while read file; do - grep -q "^$file\$" "$tmpfile" || rm -vf -- "$file" + [ -f "$SDEROOT/$file" ] || continue + + if ! grep -q "^$file\$" "$tmpfile"; then + if [ -n "$dryrun" ]; then + echo rm -vf -- "$SDEROOT/$file" + else + rm -vf -- "$SDEROOT/$file" + fi + fi done rm -f "$tmpfile"