2 # --- SDE-COPYRIGHT-NOTE-BEGIN ---
3 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
5 # Filename: bin/sde-cleanup-download
6 # Copyright (C) 2007 The OpenSDE Project
8 # More information can be found in the files COPYING and README.
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; version 2 of the License. A copy of the
13 # GNU General Public License can be found in the file COPYING.
14 # --- SDE-COPYRIGHT-NOTE-END ---
17 export SDEROOT
=$
( cd "${0%/*}/.."; pwd -P )
19 .
$SDEROOT/lib
/libsde.
in
22 local progname
=${0##*/}
24 Usage: $progname [--dry-run]
30 options
=$
( getopt
-o "$shortopts" -l "$longopts" -- "$@" )
37 # load new arguments list
38 eval set -- "$options"
42 while [ $# -gt 0 ]; do
54 mkdir
-p "$SDEROOT/tmp"
55 tmpfile
="$SDEROOT/tmp/down.$$"
57 # get list of accepted files
58 cat <<EOT > "$tmpfile"
62 .
$SDEROOT/bin
/sde-list-download
>> "$tmpfile"
64 # and check those I have against that list
65 ( cd "$SDEROOT"; find download
/ -type f
) |
while read file; do
66 [ -f "$SDEROOT/$file" ] ||
continue
68 if ! grep -q "^$file\$" "$tmpfile"; then
69 if [ -n "$dryrun" ]; then
70 echo rm -vf -- "$SDEROOT/$file"
72 rm -vf -- "$SDEROOT/$file"