فهرست منبع

Initial delete support. rmdir will frequently fail the first time through, but that is acceptable (or even desirable) for this type of app

Zachary Kotlarek 13 سال پیش
والد
کامیت
359aaab4d0
1فایلهای تغییر یافته به همراه10 افزوده شده و 2 حذف شده
  1. 10 2
      sync.sh

+ 10 - 2
sync.sh

@@ -85,8 +85,16 @@ for (( i=1; i<=${NUM_FILES}; i++ )); do
 
 
 	# Determine the action (i.e. copy to or delete from remote)
 	# Determine the action (i.e. copy to or delete from remote)
 	if [ "${ACTION}" == '+' ]; then
 	if [ "${ACTION}" == '+' ]; then
-		echo "Will not delete from remote: ${FILE}" 1>&2
-		exit 2
+		if [ -d "${PATH_REMOTE}" ]; then
+			echo "Removing directory: ${FILE}"
+			rmdir "${PATH_REMOTE}"
+		elif [ -f "${PATH_REMOTE}" ]; then
+			echo "Deleting file: ${FILE}"
+			rm "${PATH_REMOTE}"
+		else
+			echo "Unable to delete file: ${FILE}" 1>&2
+			exit 2
+		fi
 	elif [ "${ACTION}" == '-' ]; then
 	elif [ "${ACTION}" == '-' ]; then
 
 
 		# Handle files by type
 		# Handle files by type