tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: lawries@btinternet.com
Subject: Finding ctime, atime and mtime
Date: Fri, 21 Nov 2003 15:07:02 +0000 (GMT)	[thread overview]
Message-ID: <1752363.1069427222069.JavaMail.root@127.0.0.1> (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


                 reply	other threads:[~2003-11-21 15:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

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