# question about ftp in terminal



## jeepster485 (Mar 19, 2004)

Is it possible to upload an entire directory to an ftp server using a single command in Terminal?  If not could someone explain how to upload items in a directory using Terminal and ftp?  Thanks a million!


----------



## symphonix (Mar 19, 2004)

There is a terminal ftp command "mput" for "multiple put" which will do what you want.
To start ftp, type "ftp" at the terminal. You can open an address and even login on the same line, by typing *ftp usernameassword@ftpserver*

Then, enter "bin" to ensure you are in binary mode, then "lcd /path/to/local/folder" to set the local folder you want to copy onto the server. then "cd /path/to/remote/folder" to select the remote folder to place the files in.

Finally, enter *mput ** to transfer all files in the local directory into the remote folder.

You can probably script this pretty easily using a single shell script, if its a regularly occurring task. You might even use a cron job to trigger the upload at a specified interval (Type "man cron" into a new terminal window to get info on how this works) or possibly an AppleScript folder action to trigger the script anytime you change a file in a specific folder.


----------



## jeepster485 (Mar 19, 2004)

That's what I was looking for for part of my problem.  I have a web page folder on my computer.  Inside that folder are 3 other folders.  When I do mput it will upload the files inside that folder but won't upload the folders.  Is there any way to upload those folders, or do I have to created them on the web server, go into them locally and remotely, and then transfer all files inside those folders and just do that for all the folders?  I hope that makes sense.....and thank you very much for your help!


----------



## fryke (Mar 20, 2004)

You might also want to try out ncftp, which has a lot more comfort than ftp. ncftp is, of course, for the Terminal. -> http://www.macupdate.com/info.php/id/6301

From the manpage:

*The purpose of ncftp is to provide a powerful and flexible interface to the Internet standard  File  Transfer  Protocol.   It  is  intended  to replace the stock ftp program that comes with the system.

Although  the  program  appears  to be rather spartan, you'll find that ncftp has a wealth of valuable performance  and  usage  features.   The program was designed with an emphasis on usability, and it does as much as it can for you automatically so you can do what  you  expect  to  do with  a  file  transfer  program,  which  is transfer files between two interconnected systems.

Some of the cooler features include progress meters,  filename  comple- tion,  command-line  editing,  background processing, auto-resume down- loads, bookmarking, cached directory listings, host redialing,  working with  firewalls  and proxies, downloading entire directory trees, etc., etc.*

And another quote from that manpage:

*The  put  command lets you send entire directory trees, too.  It should work on all remote systems, so  you  can  try  ``put -R'' with a directory to upload the directory and its contents.*


----------



## fryke (Mar 20, 2004)

Just saw that the macupdate link contains 'old' version information. Currently 3.1.7 is new: http://www.ncftp.com/download/

You'll want this one: ftp://ftp.ncftp.com/ncftp/binaries/ncftp-3.1.7-macosx10.3.2.dmg


----------

