Only directories, modified at least 2 days ago, in WS_DOWNLOAD
are processed. All non-snapshot directories are verbosely removed.
Change-Id: Ibabb7d874e1e75453c8f348725b99346007e1908
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
. "${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