Fix
This commit is contained in:
+13
-3
@@ -15,7 +15,7 @@ set -e # Exit if error
|
|||||||
# =============================================================================
|
# =============================================================================
|
||||||
FTP_USER=card
|
FTP_USER=card
|
||||||
FTP_PASS=card
|
FTP_PASS=card
|
||||||
FTP_IP=192.168.1.21
|
FTP_IP=192.168.1.30
|
||||||
FTP_PORT=2121
|
FTP_PORT=2121
|
||||||
|
|
||||||
|
|
||||||
@@ -26,6 +26,7 @@ DESTINATION=Card/ # Local folder where to save files
|
|||||||
# will saved FTP folder "/distant/dir" in local folder "$DESTINATION/dir2"
|
# will saved FTP folder "/distant/dir" in local folder "$DESTINATION/dir2"
|
||||||
|
|
||||||
LINK=()
|
LINK=()
|
||||||
|
LINK+=("DCIM" "DCIM")
|
||||||
LINK+=("Download" "Download")
|
LINK+=("Download" "Download")
|
||||||
|
|
||||||
|
|
||||||
@@ -35,14 +36,23 @@ LINK+=("Download" "Download")
|
|||||||
|
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
echo "Start synchronisation"
|
echo "========================================================="
|
||||||
|
echo "Start synchronisation to ${DESTINATION}"
|
||||||
|
echo "========================================================="
|
||||||
|
find ${DESTINATION} -type f -exec chmod 644 {} \;
|
||||||
|
find ${DESTINATION} -type d -exec chmod 755 {} \;
|
||||||
|
|
||||||
for ((i=0; i<${#LINK[@]}; i+=2)); do
|
for ((i=0; i<${#LINK[@]}; i+=2)); do
|
||||||
DISTANT_DIR=${LINK[i]}
|
DISTANT_DIR=${LINK[i]}
|
||||||
LOCAL_DIR=${LINK[i+1]}
|
LOCAL_DIR=${LINK[i+1]}
|
||||||
echo "############################## ${DISTANT_DIR} > ${LOCAL_DIR}"
|
echo "############################## ${DISTANT_DIR} > ${LOCAL_DIR}"
|
||||||
mkdir -p "${DESTINATION}/${LOCAL_DIR}/"
|
mkdir -p "${DESTINATION}/${LOCAL_DIR}/"
|
||||||
|
|
||||||
lftp ftp://${FTP_USER}:${FTP_PASS}@${FTP_IP}:${FTP_PORT} -e "mirror -e -x .thumbnails -x "saved" \"${DISTANT_DIR}\" \"${DESTINATION}/${LOCAL_DIR}\" ; quit"
|
if lftp ftp://${FTP_USER}:${FTP_PASS}@${FTP_IP}:${FTP_PORT} -e "mirror -e -x .thumbnails -x "saved" \"${DISTANT_DIR}\" \"${DESTINATION}/${LOCAL_DIR}\" ; quit" ; then
|
||||||
|
echo "Success :)"
|
||||||
|
else
|
||||||
|
echo 'Failed !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+16
-6
@@ -15,7 +15,7 @@ set -e # Exit if error
|
|||||||
# =============================================================================
|
# =============================================================================
|
||||||
FTP_USER=ftp
|
FTP_USER=ftp
|
||||||
FTP_PASS=ftp
|
FTP_PASS=ftp
|
||||||
FTP_IP=192.168.1.21
|
FTP_IP=192.168.1.30
|
||||||
FTP_PORT=2121
|
FTP_PORT=2121
|
||||||
|
|
||||||
|
|
||||||
@@ -26,24 +26,34 @@ DESTINATION=Phone/ # Local folder where to save files
|
|||||||
# will saved FTP folder "/distant/dir" in local folder "$DESTINATION/dir2"
|
# will saved FTP folder "/distant/dir" in local folder "$DESTINATION/dir2"
|
||||||
|
|
||||||
LINK=()
|
LINK=()
|
||||||
|
LINK+=("/DCIM" "DCIM")
|
||||||
|
LINK+=("/Pictures" "Pictures")
|
||||||
|
LINK+=("/Download" "Download")
|
||||||
LINK+=("/WhatsApp/Media/WhatsApp Video" "WhatsApp_Video")
|
LINK+=("/WhatsApp/Media/WhatsApp Video" "WhatsApp_Video")
|
||||||
LINK+=("/WhatsApp/Media/WhatsApp Images" "WhatsApp_Images")
|
LINK+=("/WhatsApp/Media/WhatsApp Images" "WhatsApp_Images")
|
||||||
LINK+=("/DCIM" "DCIM")
|
|
||||||
LINK+=("/Download" "Download")
|
|
||||||
LINK+=("/Documents" "Documents")
|
LINK+=("/Documents" "Documents")
|
||||||
LINK+=("/Pictures" "Pictures")
|
|
||||||
|
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
echo "Start synchronisation"
|
echo "========================================================="
|
||||||
|
echo "Start synchronisation to ${DESTINATION}"
|
||||||
|
echo "========================================================="
|
||||||
|
find ${DESTINATION} -type f -exec chmod 644 {} \;
|
||||||
|
find ${DESTINATION} -type d -exec chmod 755 {} \;
|
||||||
|
|
||||||
for ((i=0; i<${#LINK[@]}; i+=2)); do
|
for ((i=0; i<${#LINK[@]}; i+=2)); do
|
||||||
DISTANT_DIR=${LINK[i]}
|
DISTANT_DIR=${LINK[i]}
|
||||||
LOCAL_DIR=${LINK[i+1]}
|
LOCAL_DIR=${LINK[i+1]}
|
||||||
echo "############################## ${DISTANT_DIR} > ${LOCAL_DIR}"
|
echo "############################## ${DISTANT_DIR} > ${LOCAL_DIR}"
|
||||||
mkdir -p "${DESTINATION}/${LOCAL_DIR}/"
|
mkdir -p "${DESTINATION}/${LOCAL_DIR}/"
|
||||||
|
|
||||||
lftp ftp://${FTP_USER}:${FTP_PASS}@${FTP_IP}:${FTP_PORT} -e "mirror -e -x .thumbnails -x "saved" \"${DISTANT_DIR}\" \"${DESTINATION}/${LOCAL_DIR}\" ; quit"
|
if lftp ftp://${FTP_USER}:${FTP_PASS}@${FTP_IP}:${FTP_PORT} -e "mirror -e -x .thumbnails -x "saved" \"${DISTANT_DIR}\" \"${DESTINATION}/${LOCAL_DIR}\" ; quit" ; then
|
||||||
|
echo "Success :)"
|
||||||
|
else
|
||||||
|
echo 'Failed !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user