PerlVersionOfFstat

From Pickwiki
Jump to navigationJump to search

HomePage>>SourceCode>>PerlSource

A wrapper around the unix stat function - it just prints to stdout and the calling program gets to parse the goodies.

Called by GetFileInfo

#!/usr/local/bin/perl -w

if ( -f $ARGV[0] ) {
   ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size,
    $atime, $mtime, $ctime, $blksize, $blocks) = stat $ARGV[0];
    
    print "$dev\n$ino\n$mode\n$nlink\n$uid\n$gid\n$rdev\n$size\n",
      scalar localtime($atime), "\n",
      scalar localtime($mtime), "\n",
      scalar localtime($ctime), "\n",
      "\n$blksize\n$blocks\n";
}