Any unix:
I have the following cmd line which works fine.
rsync -avr -e ssh /home/dir [email protected]:/home/
But I need to set it up now to rsync to a remote server that only has an FTP server on it. How do I go about that?
I looked at the rsync help but quickly got lost (I don't do this stuff very often).
rsync isn't going to work for you for the reasons others have mentioned. However, lftp and ncftp both have "mirror" modes that will probably meet your needs.
I use this to push stuff from my local directory to a ftp or sftp web host:
As written by easel,
lftp
is a good tool.I suggest you to parametrize the script, and make use of the
options, that excludes filenames using the glob feature (*,? ..) of your shell:
Warning: make sure that the target directory exists, otherwise the cd command will fail, so operation including deleting trees of files will take place at wrong directory (root)!
I have updated script so that
--delete
option is disabled by defaut, enable it by uncommenting theDELETE= command
.You don't. rsync can't do that for you, it is a protocol of its own and doesn't work over FTP.
You might, however, want to try csync. IIRC it provides rsync-like behaviour over HTTP. I can't comment on whether it works over FTP, you'll have to try it.
Depending of what you're actually trying to do, another completely different approach could be use
curlftps
to mount a ftp folder, and then maybersync
the two "local" folders.The installation is different depending on your distro so I can't generalize on that, but you need to install
fuse
andcurlftpfs
(prolly Debian already hasfuse
install by default), then:sudo apt-get install curlftpfs
Make sure the
fuse
module is loaded (modprobe fuse
)sudo curlftpfs ftp.yourserver.com /path/to/ftp/folder/ -o user=username:password,allow_other
Note that there's no space after the last comma (it's not a typo!). If you're satisfied with that or don't want to make that every time, you can add it to your fstab (usually in
/etc/fstab
):In that case, you have to make sure the fuse module is loaded before.
Be advised though, of two things:
curlftpfs
could fail (maybe you can do something with the.netrc
).There is weex...
rsync does not work over ftp. On the remote side it needs either the rsync daemon or a shell that it can call rsync from. Ftp generally allows you to call a few commands and rsync is not one of them. There are other tools meant for automating ftp tasks like "lftp".
For what it appears you are trying to do, you could also use wget.
wget -m ftp://username:[email protected]
This seems like a good and free fit: https://savannah.gnu.org/projects/ftpsync/
You can use curlftpfs to mount ftp and use rsync after http://linux.die.net/man/1/curlftpfs
I am using GVFS/FTP. I mount my remote FTP servers with gigolo. As they are seen as local directories almost anything working on local files works. rsync is designed to compute file hashes remotely to compare files without transferring them, but doing that with virtual files transfers the files anyway. unison and freefilesync normally work well but I met a problem when they want to rename a file thy uploaded, no problem downloading. This could be a problem with gvfs 1.6.1.