bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: I need help to use find and curl together to upload a directory


From: James Youngman
Subject: Re: I need help to use find and curl together to upload a directory
Date: Tue, 13 Aug 2013 12:26:49 +0100

On Tue, Aug 13, 2013 at 12:35 AM, Christoph Roland Murauer
<address@hidden> wrote:
> Am 12.08.2013 um 18:46 schrieb James Youngman <address@hidden>:
>
>> I don't clearly understand the problem you are trying to describe (you
>> might find it helpful to review
>> http://www.catb.org/esr/faqs/smart-questions.html).   Are you saying
>> that find launches curl with an incorrect command-line?    If so, what
>> command-line did you want and what are you getting?  If curl is being
>> launched with the command-line you expect, but you are not getting the
>> result you hope for, this is likely a problem that you should take up
>> with the curl user mailing list and/or developers.
> I don't know which part is the problem (find, curl or me). Maybe I kept my 
> question a littlebit to short.


It's easy to fix that part of your problem.   Right now you are using
this command-line:

find . -exec curl --ftp-create-dirs -T {} -v -k -u address@hidden:password
ftp://server/directory --ftp-ssl \;

If you prepend "echo" to the command-line like this:

find . -exec echo curl --ftp-create-dirs -T {} -v -k -u
address@hidden:password ftp://server/directory --ftp-ssl \;

... you can see the curl command-lines which find is issuing.   Decide
if they are what you wanted.    If yes, the problem isn't find.   If
no, you need to change that command line.

If you decide you need to change the command line, start by ignoring
find.    Figure out a curl command line which does what you want, for
one file.    Then make sure that the same command-line does what you
want for a selection of other files.    For example, files in
subdirectories.     Now you have a "golden" curl command line which
does what you want.   Next, use the version of the find command line
with "echo" in it, and tweak the command until the "curl" command
lines it prints actually match your "golden" command line.   When
you're happy, remove the "echo".

Assuming that there exists a curl command-line which can do what you
want, this should find it.   But such a thing may not exist.   As far
as I can see from the curl manpage, the uploaded files are re-written.
  That means they are truncated to a 0-byte length and the new
contents are written.    If your webserver gets a request during this
time period, the fetched file will be a prefix of the version of the
file you have on your local machine.   That will give an incorrect
result.  This effect may be rare (I don't know how often your website
gets hits) but it will likely exist.

James.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]