Re: timestamping not working when -O option is in path/filename format

2007-04-26 Thread n g

thanks to sourceforge,
here is a url from soruceforge net,

  http://images.sourceforge.net/icons/silk/feed.png

has a Last-Modified header of 'Tue, 05 Dec 2006 19:10:40 GMT'

consider these two  command:

1,
 wget  -N -O dir/feed.png \
http://images.sourceforge.net/icons/silk/feed.png
 wget  -N -O feed.png \
   http://images.sourceforge.net/icons/silk/feed.png

2,
 wget  -N  \
http://images.sourceforge.net/icons/silk/feed.png

1:
target file always downloaded if there is no file named 'feed.png' in
current working directory.

if there is a file named 'feed.png' in current working dir.,
then wget will check that file,
and if that file is same as target, no download happens.

but wget is supposed to check `dir/feed.png', not `$PWD/feed.png',
could this be a bug?

2:
target is  downloaded only once.
mtime, ctime and atime of local file remain its first download time,
that is, wget dont always `open()' local file , it just `stat()' that file.

if `-O' option is given, then wget always open local file, truncate it
to zero length,
the result is target downloaded as many times as wget run.

i guess even with `-O' option, wget should check local file first,
instead of truncate it for every run.

the case of given muiltiple Urls and single `-O' is rare,
and maybe not clearly stated in the manual.


Re: timestamping not working when -O option is in path/filename format

2007-04-25 Thread Steven M. Schweda
From: n g

> this is why i said that's a bug.

   Around here, I get consistent behavior.  Well, consistent between "-O
name" and "-O dir/name", anyway.  The behavior differs between operating
systems (say, Solaris v. VMS).  I'd guess that this is because setting
the modification date-time on an open file and then closing the file
might not be the most reliable way to set a modification date-time on
every operating system.

   You're welcome to re-write the "-O" code to work differently, but
that looks to me like a non-trivial task.



   Steven M. Schweda   [EMAIL PROTECTED]
   382 South Warwick Street(+1) 651-699-9818
   Saint Paul  MN  55105-2547


Re: timestamping not working when -O option is in path/filename format

2007-04-23 Thread n g

On 4/23/07, Steven M. Schweda <[EMAIL PROTECTED]> wrote:

From: n g

> another problem about -N option:

   No, it's the same problem with the "-O" option, which does not work
the way you seem to think that it works.  If you go to


i guess you are right. its all about `-O' option.


"http://www.mail-archive.com/wget@sunsite.dk/";, and search for "-O", you
can find a large number of similar complaints with the same explanations
for why.


i didn't do a search, because i believe this should be at least an improvement.



   For example, wget allows multiple URL's on a command line.  Which one
should it use for the time-stamp with "-O"?


if multiple Urls' given on command line,
then probably give the same number of `-O' to wget?

but if one Url is given , like this post did, i guess it shouldn't be a problem.



> while
>wget url -O name -N
> works as expected.

   Really?  What was "expected"?  With "-O", the output file is always


"expected" mean that wget should check local file modification time
before actually download the file, and if she find that remote file is
not modified since last download, i.e. the modification time is the
same as Last-Modified header,
then wget will bypass that file, no download will be performed.
like the explaination to `-N' option says.
this behavior will do benifit to bandwidth, timing, etc.


opened (created) before any communication with the server(s), so it's
always very new.  It's not obvious to me why adding a directory to


i dont know if wget open the local file every time,
but i have observed that the modification time of local file keep
unchanged between mulitiple runs of `wget -N', and no download action
took place.
wget just gave something like "xxx file skipped", and continues with
the next file.


"name" would make any difference in wget's behavior in this case.


this is why i said that's a bug.
because wget does well with a bare filename.
i.e. the `-N' option prevent unnecessary downloading.


i dont know if wget@sunsite.dk is the same mail-list as i added [EMAIL 
PROTECTED]


Re: timestamping not working when -O option is in path/filename format

2007-04-23 Thread Steven M. Schweda
From: n g

> another problem about -N option:

   No, it's the same problem with the "-O" option, which does not work
the way you seem to think that it works.  If you go to
"http://www.mail-archive.com/wget@sunsite.dk/";, and search for "-O", you
can find a large number of similar complaints with the same explanations
for why.

   For example, wget allows multiple URL's on a command line.  Which one
should it use for the time-stamp with "-O"?

> while
>wget url -O name -N
> works as expected.

   Really?  What was "expected"?  With "-O", the output file is always
opened (created) before any communication with the server(s), so it's
always very new.  It's not obvious to me why adding a directory to
"name" would make any difference in wget's behavior in this case.



   Steven M. Schweda   [EMAIL PROTECTED]
   382 South Warwick Street(+1) 651-699-9818
   Saint Paul  MN  55105-2547


Re: timestamping not working when -O option is in path/filename format

2007-04-23 Thread n g

On 4/23/07, Tony Lewis <[EMAIL PROTECTED]> wrote:

n g wrote:

> wget url -O dir/name -N
> would download the same file every run.
>
> while
> wget url -O name -N
> works as expected.

timestamping compares the timestamp on the local file with the timestamp on
the server. When you use -O the timestamp on the local file is the time the
file was downloaded (not the file from the Last-Modified header).

Tony



when Last-Modified header is present in server response,
wget always touch the downloaded file to that date after downloaded
the whole file.
that time usually not the time when the file is downloaded.

another problem about -N option:
if url has been ended in query-string , like `http://server/path/file?foo=bar',
and `-O file' is specified,   then the `-N' timestamping doesn't work either.


RE: timestamping not working when -O option is in path/filename format

2007-04-22 Thread Tony Lewis
n g wrote:

> wget url -O dir/name -N
> would download the same file every run.
> 
> while
> wget url -O name -N
> works as expected.

timestamping compares the timestamp on the local file with the timestamp on
the server. When you use -O the timestamp on the local file is the time the
file was downloaded (not the file from the Last-Modified header).

Tony