You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
592 B
Bash

#!/usr/bin/bash
FTP_DIR=~/.local/var/ftp-mount/
host="$1"
local_dir="$2"
curlftpfs "$host" "$FTP_DIR" || exit 1
# TODO: Copying to FTP produces "ftruncate failed" errors. Not sure how to convince rsync to not use
# that.
# TODO: Rsync is probably not the best tool for the job here. It has *no* conflict handling.
echo "Copying new data to FTP server."
rsync -rtu --progress --inplace "$local_dir/" "$FTP_DIR"
echo "Copying new data from FTP server."
rsync -rtu --progress "$FTP_DIR" "$local_dir"
# TODO: This should probably be in a trap function.
fusermount -u "$FTP_DIR"
echo "Done."