tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* Finding ctime, atime and mtime
@ 2003-11-21 15:07 lawries
  0 siblings, 0 replies; only message in thread
From: lawries @ 2003-11-21 15:07 UTC (permalink / raw)


Admins,

I had a requirement to list out all the time stamps
on files in a directory and thought I would share the solution.

A very quick and dirty perl script.

#!/usr/bin/perl -w
##############################################################################
#                                                                            #
# FILE NAME:            ftime                                                #
#                                                                            #
#----------------------------------------------------------------------------#
# PURPOSE: Retrive full set of file date                                     #
#                                                                            #
#----------------------------------------------------------------------------#
# usage:                                                                     #
#       List of files piped into ftime                                       #
#                                                                            #
# example:                                                                   #
#                                                                            #
#       ls -l | awk '{ print $9 }' | /usr/local/bin/ftime                    #
#                                                                            #
#----------------------------------------------------------------------------#
# REVISIONS:                                                                 #
#                                                                            #
# Lawrie  November 2003                   #
##############################################################################

use strict;
# use File::stat;

  while (<>) {

        chomp($_);
        my($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, 
           $ctime, $blksize, $blocks) = stat($_);

        my $access = localtime $atime;
        my $modify = localtime $mtime;
        my $inodes = localtime $ctime;

        printf "$_ :  \n";
        printf "     Last Access Time : $access \n";
        printf "     Last Modify Time : $modify \n";
        printf "     Last Inode change: $inodes \n";

  }

Lawrie


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-11-21 15:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-21 15:07 Finding ctime, atime and mtime lawries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox