edit: found the answer I was looking for -
http://www.perlmonks.org/index.pl?node_id=422895

don't know, what do the &'s do? all the example code I can find uses them, so I thought it was the proper function call...

the @fileStat was actually remnants of a previous attempt at figuring out how to get the date extracted that I had failed to rever to $s when I went back... explained why it was blowing up... I have the use File::stat; at the very top of the code right after the #!/usr/bin/perl... my problem is that with the code as it is right now:

sub farmInput { my($corp, $finalPath) = ($_[0], $_[1]); my $path = "/usr/local/farm/*/*/$finalPath/*$corp*"; my @farms = glob($path); foreach my $farm (@farms) { my $s = stat($farm); printf "%s: Age [%s], size [%d]\n", $farm, ParseDateString("epoch + $s->mtime()"), $s->size(); # printf "%s: Age [%s], size [%d]\n", $farm, $s->mtime(), $s->size( +); } # end of foreach statement } # end farmInput
it doesn't display anything in between the after date, but when I use the other line (the one commented out in this code) it gives me the seconds since epoch...

sooo... when I use this:

printf "%s: Age [%s], size [%d]\n", $farm, ParseDateString("epoch + $s->mtime()"), $s->size();
I get this:
/usr/local/farm/vrsn/verisignx/input/75192.hosoft.01162005.A.bctl.e.le +t.dat.Z: Age [], size [2069] /usr/local/farm/vrsn/verisignx/input/75192.hosoft.01162005.A.bills.let +.dat.Z: Age [], size [266666425] /usr/local/farm/vrsn/verisignx/input/75192.hosoft.01162005.A.billvldt. +let.dat.Z: Age [], size [72] /usr/local/farm/vrsn/verisignx/input/75192.hosoft.01162005.A.bmsg.e.le +t.dat.Z: Age [], size [2428] /usr/local/farm/vrsn/verisignx/input/75192.hosoft.01162005.A.brels.let +.dat.Z: Age [], size [8] /usr/local/farm/vrsn/verisignx/input/75192.hosoft.01162005.A.callfile. +call.dat.Z: Age [], size [126369639]
and then when I use this:
printf "%s: Age [%s], size [%d]\n", $farm, $s->mtime(), $s->size() +;
I get this
/usr/local/farm/vrsn/verisignx/input/75192.hosoft.01162005.A.bctl.e.le +t.dat.Z: Age [1106013532], size [2069] /usr/local/farm/vrsn/verisignx/input/75192.hosoft.01162005.A.bills.let +.dat.Z: Age [1106018445], size [266666425] /usr/local/farm/vrsn/verisignx/input/75192.hosoft.01162005.A.billvldt. +let.dat.Z: Age [1106018446], size [72] /usr/local/farm/vrsn/verisignx/input/75192.hosoft.01162005.A.bmsg.e.le +t.dat.Z: Age [1106013532], size [2428] /usr/local/farm/vrsn/verisignx/input/75192.hosoft.01162005.A.brels.let +.dat.Z: Age [1106013532], size [8] /usr/local/farm/vrsn/verisignx/input/75192.hosoft.01162005.A.callfile. +call.dat.Z: Age [1106020765], size [126369639]
Again, here is the entire program:
#!/usr/bin/perl use strict; use File::stat; use Date::Manip; # This is a program that is intended to allow FEP operators # a tool that will facilitate in monitoring incoming transmissions # and preprocessor logs. #------------------- Define Subroutines ------------------# # # # Main is a subroutine simply written for flow control sub Main { my $corp = $_[0]; print "Input:\n"; farmInput($corp,'input'); } # end Main # farmInput does a wildcard search of all /usr/local/farm/*/*/input fo +lders # looking for the <STDIN> corp number and printing those files to scre +en. sub farmInput { my($corp, $finalPath) = ($_[0], $_[1]); my $path = "/usr/local/farm/*/*/$finalPath/*$corp*"; my @farms = glob($path); foreach my $farm (@farms) { my $s = stat($farm); printf "%s: Age [%s], size [%d]\n", $farm, ParseDateString("epoch + $s->mtime()"), $s->size(); # printf "%s: Age [%s], size [%d]\n", $farm, $s->mtime(), $s->size( +); } # end of foreach statement } # end farmInput #------------------- End Subroutines ---------------------# print "What corp are you looking for? " ; chomp(my $whatWeWant = <STDIN>); Main($whatWeWant);

In reply to Re^6: Directory listing by FireyIce01
in thread Directory listing by FireyIce01

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.