#!/usr/athena/bin/perl # This is a simple perl script that goes through the files named # on the command line and performs a stat() on each one and # returns all of the data. # # -thumper! 6-Jul-91 3am while ($file = pop(@ARGV)) { ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks) = stat($file) or warn "Error: $!\n"; print "Device: $dev ("; printf("0x%x)\n", $dev); print "inode: $ino\n"; print "mode: $mode "; printf("(0%o)\n", $mode); print "Number of links: $nlink\n"; print "Owner: $uid\n"; print "Group: $gid\n"; print "Device ID: $rdev ("; printf("0x%x)\n", $rdev); print "Size: $size bytes\n"; print "Block size: $blksize\n"; print "Number of blocks: $blocks\n"; print "Access time: $atime ("; &realtime($atime); print ")\n"; print "Modified time: $mtime ("; &realtime($mtime); print ")\n"; print "Last file status change time: $ctime ("; &realtime($ctime); print ")\n"; } exit; sub realtime { local($timeck) = @_; local($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst); ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($timeck); printf("%2d/%02d/%2d %2d:%02d:%02d", $mon+1,$mday,$year,$hour,$min,$sec); }