File Time Stamp

File Time Stamp

Post by Karen L. Wylan » Fri, 28 Apr 2000 04:00:00



I need a way to list or just lookat the full time stamp on the creation and
modification dates of files.
The time MUST have hours, minutes AND seconds.

Thanks for a quick answer.
Karen.

 
 
 

File Time Stamp

Post by Rich Tee » Fri, 28 Apr 2000 04:00:00



> I need a way to list or just lookat the full time stamp on the creation and
> modification dates of files.

There is no way to see the file creation time.

Quote:> The time MUST have hours, minutes AND seconds.

I don't think you can do this with command line tools; you'll need to write
a short program that stat()s each file, and prints the [cm]time fields in the
format you want.

--
Rich Teer

NT tries to do almost everything UNIX does, but fails - miserably.

The use of Windoze cripples the mind; its use should, therefore, be
regarded as a criminal offence.  (With apologies to Edsger W. Dijkstra)

If it ain't analogue, it ain't music.

Voice: +1 (250) 763-6205
WWW: www.rite-group.com

 
 
 

File Time Stamp

Post by Logan Sh » Fri, 28 Apr 2000 04:00:00





>> I need a way to list or just lookat the full time stamp on the creation and
>> modification dates of files.

>There is no way to see the file creation time.

>> The time MUST have hours, minutes AND seconds.

>I don't think you can do this with command line tools; you'll need to write
>a short program that stat()s each file, and prints the [cm]time fields in the
>format you want.

Like, for example, this:

        perl -ne 'chomp; print "$_\t", scalar(localtime((stat)[9])), "\n";'

  - Logan

 
 
 

File Time Stamp

Post by Chris Thomps » Fri, 28 Apr 2000 04:00:00







>>> I need a way to list or just lookat the full time stamp on the creation and
>>> modification dates of files.

>>There is no way to see the file creation time.

>>> The time MUST have hours, minutes AND seconds.

>>I don't think you can do this with command line tools; you'll need to write
>>a short program that stat()s each file, and prints the [cm]time fields in the
>>format you want.

>Like, for example, this:

>    perl -ne 'chomp; print "$_\t", scalar(localtime((stat)[9])), "\n";'

Or if you want something with a **y* bit more error handling than that,
I offer the following from my ~/bin directory...

--- cut ---
#!/bin/perl
# Script to display the atime, mtime and ctime fields for one or more files
# accurately.

$rc = 0;



    warn "$0: Cannot stat $_: $!\n";
    $rc = $!; next;
    }


    printf "%04d-%02d-%02d %02d:%02d:%02d  ",
      1900+$time[5],1+$time[4],$time[3],$time[2],$time[1],$time[0];
    }
  print $_,"\n";
  }

exit $rc
--- cut ---

Chris Thompson
Email: cet1 [at] cam.ac.uk

 
 
 

File Time Stamp

Post by Jay Lesse » Sat, 29 Apr 2000 04:00:00




Quote:>I need a way to list or just lookat the full time stamp on the creation and
>modification dates of files.

You can't.

"mtime" does mean "modification", so you're ok there, but "ctime"
means "change", NOT "creation".

e.g.:

% ls -l .profile
-rw-r--r--   1 jdl           814 Jul 20  1997 .profile
% filetimes .newsrc
File .profile:
        atime: Mon Jun 21 11:17:36 1999
        mtime: Sun Jul 20 17:58:57 1997
        ctime: Mon Jun 21 11:17:10 1999
% chmod o-r .profile
% ls -l .profile
-rw-r-----   1 jdl           814 Jul 20  1997 .profile
% filetimes .profile
File .profile:
        atime: Mon Jun 21 11:17:36 1999
        mtime: Sun Jul 20 17:58:57 1997
        ctime: Fri Apr 28 16:05:45 2000

See?

--

 
 
 

1. How to compare file time stamps in condition statements?

Hi All

    I read find command. No example there. I written script. But that is
too long. If anybody can have very simple solution help me out.

    I want to compare two files like

    if     fileA is newer than  fileB
        .....
     else
        .....
    fi

THANKS
ASHOK

2. Slackware 8.0 install problems

3. Compering file time stamps

4. 2.5.43 oops in adaptec driver

5. Dosemu file time stamp question

6. how do i bypass a firewall

7. Possible to modify file time-stamps?

8. <BREAK> with a serial port controler

9. kernel 2.4.2 and wrong file time stamps

10. Time discrepancy between Linux and DOS time stamps for same file

11. Changing File Modified Time/Date Stamp

12. File Mode and Time Stamp

13. How to obtain the age of a file (epoch time stamp)