Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I just discovered that some of my files have traveled back in time! I like to keep my files arranged by modification date and was surprised to find that some (but not all) of my files are now showing a "Modified" date in December, instead of today's date like they should.

I am using Ubuntu Release 10.04 (lucid), Kernel Linux 2.6.32-38-generic, GNOME 2.30.2 . The folder/directory I 'm looking at is in a ext3 filesystem.

I booted up this morning, and it did do that disk check thing, but I don't think it changed anything at that time (but I wasn't really on for long). It's only after I booted up again this evening that I noticed things weren't where I expected them.

This is so annoying! Does anybody know what happened and how I can fix this?

share|improve this question
    
if you open a file and try to change something or copy or move the file then file's last modification date change. check your system date. And also sure that your BIOS battery is working. –  shantanu Feb 26 '12 at 2:25
    
But dates have changed to an earlier date. The system date is correct. I don't know about the BIOS battery, but I don't see how that could change (some and not all stuff to an earlier time. –  Roy Feb 26 '12 at 2:39
add comment

1 Answer

Changing the time back to the current date and time is fairly easy. From the manpage:

touch {filename}

You can use wildcards. Also with ...

-d, --date=STRING
          parse STRING and use it instead of current time

you can use a custom date and with

-t STAMP
          use [[CC]YY]MMDDhhmm[.ss] instead of current time

you can use a custom time in case you want specific timestamps set for those files.

As to why it happend that is going to be guesswork. Some examples:

  • files could come from another machine that has a wrong date.
  • files could have been restored from a backup or tar file.
  • your time was set wrongly.
share|improve this answer
    
Thanks, but I don't don't want to change modified date to current date. I want to them to have the correct "modified time" ! I want whatever files I last edited in January to come before files I last edited this month. Instead, I discovered a file I edited just today arranged with older files. That's when I discovered the problem. At least the contents weren't changed, i.e. they still had today's edits. –  Roy Feb 26 '12 at 2:43
    
Also, thanks for the guesses, but none of them apply in this case... I did copy one of the affected files to another filesystem, but I don't see why that would affect the source file. –  Roy Feb 26 '12 at 2:49
    
There are so many causes for this it's impossible to answer. and regarding the 1st comment you made: you can manually set the timestamp with the -t option I included (and yes you will need to decide what timestamp each file needs to get and manually issue touch for every file). –  Rinzwind Feb 26 '12 at 3:39
    
I appreciate the responses; thanks for trying to help. Regarding "many causes" believe me when I say that there was at max an elapsed time of usage on the system of less than an hour, single user (me), and the only applications used were gedit, Firefox, possibly Eye Of GNOME, and I also copied some files to (not from) an external drive over older copies. –  Roy Feb 28 '12 at 1:28
add comment

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.