Ftp – How to FTP multiple folders to another server using mput in Unix

ftpunix

I am logged in on a server (using Putty). from there I'm connecting using FTP to another server. I want to copy several folders from the first server to the second server using mput.

Like:

ftp> mput folder1 folder2 folder3

But I get "folder1: not a plain file."…and so on. Each of these folders have subfolders, files (some binary, some not).

How can I accomplish what I want without zipping the stuff and then transfer?

Best Answer

Command line FTP is pretty primitive.

You can't recursively send files/folders towards a remote site.

If you want to recreate a directory structure on the remote side the same as the local, you need to manually mkdir each path and use mput * to send everything in that directory to the remote side.

Two options to make this easier:

  1. Stop using the primitive FTP command (ncftp is a good alternative)

  2. Use tar to tar up the folders, send the file and extract on the far side.