Upload the whole directory with FTP from the command line

28,442

Solution 1

You would use mput *.* (multiple put).

You may need to use lcd (local change directory), but not likely. I believe it defaults to the folder the command is run from.

Here is a list of commands you can use.

Solution 2

I'm not sure that the underlying FTP protocol provides for a recursive transfer of a directory. Your best bet is to zip it, send it, and then unzip the directory at the remote location.

Share:
28,442

Related videos on Youtube

Jonan
Author by

Jonan

Updated on September 18, 2022

Comments

  • Jonan
    Jonan over 1 year

    I've got this .bat file:

    ftp -s:commands.txt
    

    File commands.txt:

    open www.domain.nl
    username
    password
    cd path/to/upload/to/
    prompt
    

    How can I now upload the folder where I ran the .bat to the server? It doesn't really matter if upload.bat and commands.txt get uploaded too.

  • Jonan
    Jonan about 10 years
    I just tested this, and it works fine for all the files directly in the current directory. However, it gives an error for subdirectories. How can I get this to work?
  • Jonan
    Jonan about 10 years
    could I also automatically zip the folder? and how could I unzip it on the server?
  • Keltari
    Keltari about 10 years
    unfortunately, with the Windows FTP client, you cant. You would have to use a 3rd party FTP program such as NcFTP - ncftp.com