Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?


share|improve this question

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.

share|improve this answer

I made a bash script:

cd /path/to/local/folder/$folder
ftp -in <<EOF
open $ftp_site
user $username $passwd
mkdir $remote/$folder
cd $remote/$folder
mput *

and called it with

find . -type d -exec ./ {} \;

seems to work.

share|improve this answer

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

share|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

Secure Copy scp has a -r recursive flag that you might find useful.

share|improve this answer

open powershell cd to the directory you want to upload run the following commands:

1. gci -r | % {if ($_.PSIsContainer) {$t = $((($_.fullname -split "\\")[$(((pwd) -split "\\").length)..200]) -join "/"); "mkdir ""$t""`r`nmput ""$t/*"" ""$t"""}} | sc .\mput_all
2. notepad .\mput_all

Paste the results into your ftp window. Enjoy. Also don't forget to add mput * to transfer all the files from the base directory.

share|improve this answer
Since when does PowerShell run on a Unix system? – Michael Hampton Apr 15 '14 at 0:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.