Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When downloading a file or e.g. unzipping one, the time stamp is not set to when the file appeared on my harddisk, which is what I want.

See this example

~$ wget https://www.google.com/images/srpr/logo3w.png
~$ stat logo3w.png 
  File: `logo3w.png'
  Size: 7007        Blocks: 16         IO Block: 4096   regular file
Device: fd00h/64768d    Inode: 17040834    Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/      ss)   Gid: ( 1000/      ss)
Access: 2012-07-25 10:58:26.000000000 +0200
Modify: 2012-04-02 04:13:37.000000000 +0200
Change: 2012-07-25 10:58:26.254385152 +0200
 Birth: -
~$ ll logo3w.png 
-rw-rw-r-- 1 ss ss 7007 Apr  2 04:13 logo3w.png

This behaviour is "new" and has happens within the last couple of years.

Question

Is it possible to disable this, so when a file is written to disk, it gets the time stamp when I did it?

share|improve this question
    
This happens because the application you used to download or unzip explicitly resets the file's date. It does this because that's the useful behavior most of the time. I doubt your assertion that this didn't use to happen: this behavior doesn't tend to change over time, are you sure you were using the same application a couple of years ago? –  Gilles Jul 25 '12 at 22:46
    
@Gilles: For example, wget 1.12 we have at work does not have the --no-use-serer-timestamps option. It resets the file's date, of course. –  choroba Jul 25 '12 at 23:14

3 Answers 3

up vote 3 down vote accepted

from the wget man page:

       --no-use-server-timestamps
           Don't set the local file's timestamp by the one on the server.

           By default, when a file is downloaded, it's timestamps are set to
           match those from the remote file. This allows the use of
           --timestamping on subsequent invocations of wget. However, it is
           sometimes useful to base the local file's timestamp on when it was
           actually downloaded; for that purpose, the
           --no-use-server-timestamps option has been provided.

unzip also has a -D option to skip restoration of timestamps for extracted items. see the man page and search for -D for details.

share|improve this answer

I do not see any such option for my version of wget. Maybe you can just touch everything you download?

share|improve this answer

As seen in How to create an RPM package:

add the text timestamping = on to ~/.wgetrc

so I'd imagine doing

timestamping = off

will do it

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.