curl-users
Re: wildcards for uploads
Date: Thu, 11 Oct 2007 16:08:14 -0700
Seb wrote:
> If I do that -T globbing though, curl strips the directory part of the
> file name, so it ends up putting everything under the /absolute/path,
> rather than in the specified subdirectories (and creating them if
> necessary with --ftp-create-dirs flag). Am I missing something here
> again?
I wonder if this has to do with URL requiring a trailing slash on the
end. You could also try:
cd ~/local/dir
URL=ftp://remote/dir/absolute/path/
ARGS=$(find -L . -name 'source' -prune -o ! -name '*~' \
-type f -printf "-T %P $URL " )
curl -v --disable-epsv --ftp-create-dirs -u user:passwd $ARGS
Note that it's essential *not* to quote "$ARGS" on the last line which
is the normal practice when a variable contains whitespace, however here
you actually want the value split. However this will fail if any of the
filenames contain spaces. You could fix *that* by embedding actual
double-quote characters into the printf string and then using eval at
the end, I suppose. It's at that point that I think I'd just use rsync
and be done with it. :)
Brian
Received on 2007-10-12