diff options
-rwxr-xr-x | tsp/scripts/free_diskspace.sh | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tsp/scripts/free_diskspace.sh b/tsp/scripts/free_diskspace.sh index 5aa0a24..566005c 100755 --- a/tsp/scripts/free_diskspace.sh +++ b/tsp/scripts/free_diskspace.sh @@ -23,12 +23,18 @@ export TSP_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)/.." . "${TSP_DIR}/common.sh" -for i in $(find "${WS_DOWNLOAD}" -type d -mtime +2) +for i in $(find "${WS_DOWNLOAD}" -maxdepth 1 -mindepth 1 -type d -mtime +1) do - if grep -q "Snapshot" "$(ls $i/diff-*.report)" + DIFF_FILE="$(ls $i/diff-*.report)" + if [ -z "${DIFF_FILE}" ] then - echo "Skipping " "$i" - continue + echo "Missing diff-*.report in: " "$i" + else + if grep -q "Snapshot" "${DIFF_FILE}" + then + echo "Snapshot, skipping:" "$i" + continue + fi fi rm -vr "$i" done |