Răsfoiți Sursa

We do not care if a file does not exist when we want to delete it

Zachary Kotlarek 12 ani în urmă
părinte
comite
9501889ac3
1 a modificat fișierele cu 5 adăugiri și 1 ștergeri
  1. 5 1
      sync/syncUnwatched.sh

+ 5 - 1
sync/syncUnwatched.sh

@@ -93,7 +93,11 @@ IFS=$'\n'
 MIN_AGE="`date -v -1H +%s`"
 for i in $OLD_FILES; do
 	# Skip files under 1H old to avoid churn and provide a no-delete signal for other conditions (e.g. filename encoding)
-	if [ `stat -f '%m' "${BASE_DIR}/${i}"` -ge $MIN_AGE ]; then
+	STAT="`stat -f '%m' "${BASE_DIR}/${i}" >/dev/null 2>&1`"
+	if [ -z "${STAT}" ]; then
+		STAT=1
+	fi
+	if [ $STAT -ge $MIN_AGE ]; then
 		if [ $DEBUG -gt 0 ]; then
 			echo "Will skip due to minimum age: ${BASE_DIR}/${i}"
 		fi