Skip to content
Advertisement

How to copy all files via FTP in rsync

I have online account with some Host which give me FTP account with username and password .

i have another with copany which gave me FTP and rsync .

Now i want to transfer all my files from old FTP to NEW FTP with rync.

Now is it possible to do it via rsync only because i don’t want to first copy on computer and then upload again

Advertisement

Answer

Lets call the machine with only FTP src.

Lets 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 away the password to anyone else on the system. (As well as transferring it over the wire in the clear, but you knew that.)

If you don’t have access to wget, then they might have ncftp or lftp or ftp installed. I just happen to know wget the best. 🙂

Edit To use ftp, you’ll need to do something more like:

ftp src
user username
pass password
bin
cd /pathname
ls

At this point, note all the directories on the remote system. Create each one with !mkdir. Then change into the directory both locally and remotely:

lcd <dirname>
cd <dirname>
ls

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

If this looks awful, it is because it is. FTP wasn’t designed for this, and if your new host doesn’t have better tools (be sure to look for ncftp and lftp and maybe something like ftpmirror), then either compile better tools yourself or get good at writing scripts around the bad tools. 🙂

Or if you could get a shell on src, that’d help immensely too. FTP is just not intended for transferring thousands of files.

Anyway, this avoids bouncing through your local system, which ought to help throughput significantly.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement