Created
November 12, 2014 22:24
-
-
Save raphiz/f72488e2fb54ca055d12 to your computer and use it in GitHub Desktop.
Synchronize FTP server with a local directory (Linux)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Requires: curlftpfs, unison and fuse. | |
# Configuration: | |
MOUNTPOINT=/mnt/my_ftp_share/ | |
LOCAL="/home/user/directory" | |
FTP_HOST="example.com" | |
FTP_USER="user" | |
FTP_PASS="secrit" | |
FTP_SUBFOLDER="httpdocs/" | |
# Mount FTP share | |
curlftpfs "$FTP_USER:$FTP_PASS@$FTP_HOST" "$MOUNTPOINT" | |
# Sync and accept defaults | |
unison -auto "$MOUNTPOINT/$FTP_SUBFOLDER" "$LOCAL" | |
# Umount | |
fusermount -u "$MOUNTPOINT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment