cancel
Showing results for 
Search instead for 
Did you mean: 

Files date

SOLVED
Go to solution
Manuales
Super Advisor

Files date

I have files with their date as follows:

Jan 12 2009 File1
Aug 12 1996 File2
Feb 12 12:20 File3
Jul 13 13:30 File4
Nov 11 15:20 File5

why the last two ones do not have the correct year? We are on Feb right now and they say Jul and Nov.
I know when the file does not contain the year, that means the file belongs to current year, in this case for the last two above files, they were created last year or last 2 years i do not know because they were created on July and November and right now we are on February.

Can anyone of you explain me why this happens?

thanks in advance.
Regards.

7 REPLIES
James R. Ferguson
Acclaimed Contributor
Solution

Re: Files date

Hi:

This is correct, expected behavior. If you read the manpages for 'ls' under the '-l' option you will note, "If the time of last modification is greater than six months ago, or any time in the future, the year is substituted for the hour and minute of the modification time."

Regards!

...JRF...
Patrick Wallek
Honored Contributor

Re: Files date

>>I know when the file does not contain the
>>year, that means the file belongs to current
>>year,

No, that's not quite right.

If the file is less than 6 months old, then the year will not be displayed.

I'm surprised that the "Jul 13" file does not have the year yet. In any case, it is relatively safe to say that both of those files are from 2009.
James R. Ferguson
Acclaimed Contributor

Re: Files date

Hi (again);

> Patrick: I'm surprised that the "Jul 13" file does not have the year yet.

We don't know from when Manuales snipped this view :-)

Certainly a file last modified on that date will show the year instead of the time today.

Regards!

...JRF...
Patrick Wallek
Honored Contributor

Re: Files date

Hi Jim -- Good point. The other possibility, which I don't often think about is: "...or any time in the future..."

It is possible that the file was created with a 2010 (or later) year via touch or some other mechanism.
Dennis Handly
Acclaimed Contributor

Re: Files date

Patrick Wallek
Honored Contributor

Re: Files date

Disregard my last comment. I misread / misunderstood the man page excerpt Jim posted. If the file was created with a future date, the year WOULD be there.

It's been a long day and it's not even noon here yet.......
Dennis Handly
Acclaimed Contributor

Re: Files date

>Patrick: "or any time in the future..."

From a thread above, it has to be more than an hour in the future.