Finding ctime, atime and mtime

From: <lawries_at_btinternet.com>
Date: Fri, 21 Nov 2003 15:07:02 +0000 (GMT)

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
Received on Fri Nov 21 2003 - 15:08:14 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:44 NZDT