curl-users
Re: wildcards for uploads
Date: Thu, 11 Oct 2007 14:20:30 -0500
On Thu, 11 Oct 2007 18:13:20 +0800,
"Song Ma" <songmash_at_gmail.com> wrote:
> There's (currently) no support for that kind of wildcard operations
> in curl. It should be very easy to write a shell script to handle the
> wildcard and make the output as the parameter for curl. The user can
> keep curl command line in a loop until all the files represented by
> wildcard are porcessed.
Thanks, I moved on writing a for loop in bash:
---<---------------cut here---------------start-------------->---
WD=~/local/dir
# We upload files to this URL
URL=ftp://remote/dir//absolute/path
# These are the paths that will be fed to curl to upload to the URL above.
UPLOADFILES=$(find -L ${WD} -name 'source' -prune -o ! -name '*~' \
-type f -print)
cd ${WD}
for i in ${UPLOADFILES}; do
fn="${i#${WD}/}" # strip the working directory part off path
echo "${fn}"
curl -v --disable-epsv --ftp-create-dirs -u user:passwd \
-T ${fn} ${URL}
done
---<---------------cut here---------------end---------------->---
I made sure ${fn} is really what's needed. However, I see that the
connection hangs indefinitely after transferring a few files. It hangs
here (replacing private info):
---<---------------cut here---------------start-------------->---
include/ie.css
* About to connect() to host.url port 21 (#0)
* Trying host.ip.address ... connected
* Connected to host.url (host.ip.address) port 21 (#0)
---<---------------cut here---------------end---------------->---
This looks like an issue with the server, rather than something wrong in
my curl call, since the first files do get transferred. Am I correct with
this? Any clues what might be happening on the ftp server side?
Thanks,
-- SebReceived on 2007-10-11