Basically i'm working in a directory and I have about 8 subdirectories worth of files that I need to analyze, not a large fileset but i'm basically looking to stat them all.
I think this code should analyze the last access time, modify time and last create time.
Based on timestamps, if I wanted to also add start time, end time and how many batches were associated with each file, could someone show me how I would modify this?:
#!/usr/bin/env perl
use strict;
use warnings;
use File::Find;
use Time::localtime;
use File::stat;
for ( @ARGV )
{
print "\nFile: $_";
print "\n Last access time: ", ctime( stat($_)->atime );
print "\n Last modify time: ", ctime( stat($_)->mtime );
print "\n File creation time: ", ctime( stat($_)->ctime );
}
The only thing i'm iffy on is how to pipe the files in the eight subdirectories into that code? Would it be easier to copy/save the files that I need to analyze to my home directory and call that file somewhere in my code? I'm still pretty new to perl so any help would be greatly appreciated.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.