cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Globbing Problem

From: Jochen Hayek <Jochen+curl_at_Hayek.name>
Date: Wed, 14 Feb 2007 22:16:42 +0100

>>>>> "JC" == James Cook writes:

    JC> I'm successfully uploading a file at a time, but any time I try to
    JC> glob files, only the first one is uploaded.

    JC> Formats I've tried:

    JC> curl -u user:passwd -T /folder1/folder2/file1.txt,
    JC> /folder3/folder4/file2.txt ftp://ftp.upload.com/myfile

wrong, see below!

    JC> curl -u user:passwd -T /folder1/folder2/file1.txt -T
    JC> /folder3/folder4/file2.txt ftp://ftp.upload.com/myfile

wrong, see below!

    JC> curl -u user:passwd -T "{/folder1/folder2/file1.txt,
    JC> /folder3/folder4/file2.txt}" ftp://ftp.upload.com/myfile

Still one mistake.
The target is a file, right?
At least it sounds like a file, not a directory.

From the manual page:

    -T/--upload-file <file>

        This transfers the specified local file to the remote URL. If
        there is no file part in the specified URL, Curl will append
        the local file name.

        NOTE that you must use a trailing / on the last directory

Have you read this?
Does this ring a bell?

        to really prove to Curl that there is no file name or curl
        will think that your last directory name is the remote file
        name to use. That will most likely cause the upload operation
        to fail.

        [...]
        curl also supports "globbing" of the -T argument, meaning that
        you can upload multiple files to a single URL by using the
        same URL globbing style supported in the URL, like this:

        curl -T "{file1,file2}" http://www.uploadtothissite.com

So you must use the curly braces.
They are not here for fun.

        or even

        curl -T "img[1-1000].png" ftp://ftp.picturemania.com/upload/
Received on 2007-02-14