How to copy all files via FTP in rsync

I have an online account with some host that gives me an FTP account with username and password.

I have another with a copy that gave me FTP and rsync.

Now I want to transfer all my files from old FTP to NEW FTP using rync.

Now this can be done with rsync only because I do not want to copy to the computer first and then download again

+6
source share
3 answers

Allows you to call the machine only with FTP src .

Allows you to call the machine with FTP and SSH dst .

 ssh dst cd destination-direction wget --mirror --ftp-user=username --ftp-password=password\ --no-host-directories ftp://src/pathname/ 

Note that running wget with --ftp-password on the command line will give a password to someone else on the system. (And also transmit it over the wire in a clear form, but you knew that.)

If you do not have access to wget , they may have ncftp or lftp or ftp . I just know wget best. :)

Change To use ftp , you need to do something more similar:

 ftp src user username pass password bin cd /pathname ls 

At this point, pay attention to all directories on the remote system. Create each with !mkdir . Then go to the directory both locally and remotely:

 lcd <dirname> cd <dirname> ls 

Repeat all directories. Use mget * to get all files.

If it looks awful, that's because it is. FTP was not designed for this, and if your new host does not have the best tools (be sure to find ncftp and lftp and possibly something like ftpmirror ), then either compile the best tools yourself, or get good ones when writing scripts around bad tools. :)

Or, if you can get a shell on src , that would help a lot too. FTP is simply not designed to transfer thousands of files.

In any case, this avoids jumping over your local system, which should greatly help in bandwidth.

+14
source

There are always reliable FUSE, CurlFtpFS, and SSHFS file systems. Mount each server using the appropriate file system and copy it using standard utilities. This is probably not the fastest way to do this, but perhaps the least time consuming.

+4
source

I was looking for a simple solution to synchronize a remote folder with a local folder via FTP, only replacing new files. I am stuck with a small wget script based on sarnold answer , which I thought could be useful for others as well, so here:

 #!/bin/bash HOST="1.2.3.4" USER="username" PASS="password" LDIR="/path/to/local/dir" # can be empty RDIR="/path/to/remote/dir" # can be empty cd $LDIR && \ # only start if the cd was successful wget \ --continue \ # resume on files that have already been partially transmitted --mirror \ # --recursive --level=inf --timestamping --no-remove-listing --no-host-directories \ # don't create 'ftp://src/' folder structure for synced files --ftp-user=$USER \ --ftp-password=$PASS \ ftp://$HOST/$RDIR 
+1
source

Source: https://habr.com/ru/post/887989/


All Articles