Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to upload a whole folder, including it's sub-folders and files to a folder on my server from a Windows batch (.bat) file.

Below is the command I have for the Upload part...

curl -T E:\Server\bootstrap3\_gh_pages\ -u USER:PASSWORD ftp://domain.com/bootstrap/

This is the error I get

curl: Can't open 'E:\Server\bootstrap3\_gh_pages\'!
curl: try 'curl --help' for more information

If I try to do just 1 file, it works fine, I need to somehow loop through and do all folders and files, any help please?

I have Googled and tried a couple not very good examples with no luck on this exact question yet

share|improve this question

1 Answer 1

Since curl was written for *nix (unix), there can be problems specifying working commands from the Windows Command Prompt. This is mostly related to the processing of " (double-quote) marks, and \ (backslashes).

A simple thing you can try is:

  1. Enclose filenames in double-quotes.
  2. Escape the backslashes by adding another backslash before each desired backslash.

So, like this:

curl -T "E:\\Server\\bootstrap3\\_gh_pages\\" -u USER:PASSWORD ftp://domain.com/bootstrap/

You could also try using forward-slashes like this, which might work:

curl -T "E:/Server/bootstrap3/_gh_pages/" -u USER:PASSWORD ftp://domain.com/bootstrap/


Another thing you could try is to use the -K (or --config=) command line option switch for curl (some helpful information can be found here).

Basically, you place all the command line arguments in a file and use -K file (or --config=file) to tell curl where to find the arguments.

So, you create a file (example: test.txt) that has each command line option on a separate line like this:

-T "E:\\Server\\bootstrap3\\_gh_pages\\"
-u USER:PASSWORD
--url=ftp://domain.com/bootstrap/

Then run curl like this:

curl -K test.txt
  or
curl --config=test.txt



If none of this works, you may need to run the curl command from a Cygwin terminal window on Windows. See this webpage for info on using curl with Cygwin on Windows.

share|improve this answer
    
Am just curious, any particular reason why you didn't undelete your original answer, and edit it if required? –  Karan May 3 '13 at 17:19

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.