155 pts.
 Uploading a directory using Windows Command line FTP
I am having a problem wrapping my head around creating a very basic script to upload a directory to an FTP site. I am able to create a directory on the local machine to include the day and date in the directory name using the variables %day% and %date%. Using today's date, the result is a directory name being created as "1206_Files".

I now need to upload this directory to an FTP server with any files or subfolders included. I cannot find a way to upload a directory using the Windows Command line FTP. I tried instead to create a directory on the FTP server using the date and day variables that worked on the local machine. These do not work using the mkdir FTP command.

The variables come through as literal character resulting in a directory named "%day%%date%_files". So my questions are: - is there a way to upload a directory using the Windows command line FTP? (zipping the directory is not an option) - is there a way to create a directory on the FTP server using the date and day variables for the name? - is there a way to perhaps mirror a directory structure from a local machine to an FTP site?

Software/Hardware used:
ASKED: June 12, 2009  5:41 PM
UPDATED: May 8, 2013  3:55 PM

Answer Wiki:
You can use the MPUT statement to upload the entire folder. You'll need to use the PROM statement so that it doesn't prompt you to upload each file. Something like this.
BIN
PROM
MPUT *.*
You'll still need to create the folder first as there isn't a command to upload recursive folders over FTP.
Last Wiki Answer Submitted:  May 8, 2013  3:55 pm  by  Michael Tidmarsh   14,060 pts.
All Answer Wiki Contributors:  Michael Tidmarsh   14,060 pts. , Denny Cherry   64,550 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Thanks. I am comforatable with using MPUT for multiple files. My issue is either uploading a folder (which looks to be impossible) or creating a folder name using mkdir based on date variables from the uploading workstation and not the local time.

 155 pts.

 

Found the wput command line tool. Am testing this out to see if it will meet my needs.

 155 pts.

 

Hi,

for the sake of mirroring you can try also rsync, specifically cwrsync for windows. However, you’ll need to instal this on the server side also (if case of windows server) if you have admin rights there.

BR,

Petko

 3,120 pts.

 

WPUT will not upload a directory but will do the entire contents of a directory. I am at the point where I need to issue an FTP command to create the directory on the remote FTP server but the name will change each day as the directory name is based on the date.

I am thinking to rename the local directory under Windows on the local machine then gather this name into a file or variable in memory. How can I then issue a command like mkdir and reference either the variable in memory or the file containing the current name of the local directory??

Thanks

 155 pts.

 

Thanks it is working…Thank you so much…

But i want to upload files from sub-directories with cmd…Please help me in this as soon as you can.

Thanks Again
Asif Shakeel Mirza

 10 pts.