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?

Thanks.

link|improve this question
feedback

3 Answers

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.

link|improve this answer
feedback

This is not possible with the normal ftp program as mput does not use recursion. You could use ncftp and then call 'mput -r folder'.

Best wishes, Fabian

link|improve this answer
That's exactly what I did recently on an RHEL 5 box. In the EPEL package, the executable is named ncftpput. – Suppressingfire Dec 4 '09 at 20:04
Can't change anything in the server's configuration. I'm just an user... – Mircea Dec 4 '09 at 20:10
It depends on your client. Not on the server. – halfdan Dec 4 '09 at 21:53
feedback

I made a bash script:

Code:

!/bin/bash

ftp_site=ftp.yoursite.net username=my_user_name passwd=my_password remote=/path/to/remote/folder folder=$1 cd /path/to/local/folder/$folder pwd ftp -in <

and called it with

Code:

find . -type d -exec ./recursive-ftp.sh {} \;

seems to work.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown