This commit is contained in:
2026-08-01 09:41:03 +02:00
parent dfe79857df
commit f4a7362c4d
3 changed files with 30 additions and 9 deletions
+13 -3
View File
@@ -15,7 +15,7 @@ set -e # Exit if error
# =============================================================================
FTP_USER=card
FTP_PASS=card
FTP_IP=192.168.1.21
FTP_IP=192.168.1.30
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"
LINK=()
LINK+=("DCIM" "DCIM")
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
DISTANT_DIR=${LINK[i]}
LOCAL_DIR=${LINK[i+1]}
echo "############################## ${DISTANT_DIR} > ${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