Which file got created first

Which file got created first

am 22.10.2007 13:21:01 von ramesh.thangamani

In my Linux home directory I have a directory which contains lot of
log files. I need to find out which file got created first and which
one next like that.... Since Unix/Linux doesn't store the file
creation time it seems to be impossible to find out which one got
created first. We don't have any way out ?.

Does it boil down to creating file with timestamp ?

Re: Which file got created first

am 22.10.2007 13:43:41 von Stephane CHAZELAS

2007-10-22, 04:21(-07), ramesh.thangamani@gmail.com:
> In my Linux home directory I have a directory which contains lot of
> log files. I need to find out which file got created first and which
> one next like that.... Since Unix/Linux doesn't store the file
> creation time it seems to be impossible to find out which one got
> created first. We don't have any way out ?.
>
> Does it boil down to creating file with timestamp ?
[...]

If by creation time, you mean the last time an inode link count
changed from 0 to 1, then the answer is yes, it's true that it
is not stored.

You could include the date in the name of the link. This way,
you could have a creation time for every link that file is known
as.

--
Stéphane

Re: Which file got created first

am 22.10.2007 15:49:35 von Ed Morton

On 10/22/2007 6:21 AM, ramesh.thangamani@gmail.com wrote:
> In my Linux home directory I have a directory which contains lot of
> log files. I need to find out which file got created first and which
> one next like that.... Since Unix/Linux doesn't store the file
> creation time it seems to be impossible to find out which one got
> created first. We don't have any way out ?.
>
> Does it boil down to creating file with timestamp ?
>

You can't compare creation times, but does your file ever get modified after
it's created? If notm you can compare modification times.

Ed

Re: Which file got created first

am 22.10.2007 20:08:50 von Rikishi 42

On 2007-10-22, ramesh.thangamani@gmail.com wrote:
> In my Linux home directory I have a directory which contains lot of
> log files. I need to find out which file got created first and which
> one next like that.... Since Unix/Linux doesn't store the file
> creation time it seems to be impossible to find out which one got
> created first. We don't have any way out ?.
I had believed the creation time would stay the same after updates, but it
doesn't. But then I never rely on system dates, they get screwed up to
easily.

> Does it boil down to creating file with timestamp ?
Well, if you can define the log file's names yourself, why not? You could
give them create date/time stamps. Or, if you only want to know the order,
give them files numbers.


But if the content is preceded with a date/time stamp on each line/entry -
as is often the case - then you can easily write a little tool that can show you
the first entry date in a file. Or build an ordered overview. Or rename the
files to include that info in their names.
Don't know what kind of logs these are, so...

--
There is an art, it says, or rather, a knack to flying.
The knack lies in learning how to throw yourself at the ground and miss.
Douglas Adams

Re: Which file got created first

am 23.10.2007 02:51:18 von Barry Margolin

In article <471CAA6F.1040302@lsupcaemnt.com>,
Ed Morton wrote:

> On 10/22/2007 6:21 AM, ramesh.thangamani@gmail.com wrote:
> > In my Linux home directory I have a directory which contains lot of
> > log files. I need to find out which file got created first and which
> > one next like that.... Since Unix/Linux doesn't store the file
> > creation time it seems to be impossible to find out which one got
> > created first. We don't have any way out ?.
> >
> > Does it boil down to creating file with timestamp ?
> >
>
> You can't compare creation times, but does your file ever get modified after
> it's created? If notm you can compare modification times.

He said they're log files. Most log files get written to for hours or
days after they're created, depending on the log rotation schedule.

Unless he's talking about the old log files that get saved by the
rotation script. Those are not usually modified after they're created,
which is typically by renaming the original log file. So the
modification time usually corresponds to the time of the last log
message, and ctime is the time that the rotation script ran.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***