cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: newb q about uploading a FOLDER to ftp

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Mon, 3 Nov 2008 11:43:12 -0800

On Mon, Nov 03, 2008 at 12:05:28PM -0700, Samuel Fitz wrote:
> howdy gang,
> i've just gotten into curl in the past few months and it has been a major time
> saver in uploading one file to multiple sites. here is and example of the code
> i have been using:
> curl -T /Users/samfitz/vm/vertical-sites/VMcURL/images/site/file.php ftp://
> gtrbnd:*******@www.allbendoregon.com//www/gtr-bnd/ -v
>
> i just recently tried uploading an entire FOLDER using this same code structure
> and the process creates a 0kb file on the ftp server rather than a new folder
> with all the housed files (and other folders).

This is the relevant FAQ item:
http://curl.haxx.se/docs/faq.html#Can_I_do_recursive_fetches_with
curl is designed for transferring individual URLs, not bunches at once like
you would want to do in transferring a directory full of files. You can
do that with a scripted loop of some sort, like this in bash:

for f in folder/*; do curl -T "$f" -u user:pass ftp://some-site/dir/; done

or this in Windows:

for %f in (folder\*) do curl -T %f -u user:pass ftp://some-site/dir/

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
-------------------------------------------------------------------
List admin: http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2008-11-03