Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Perl script to find the file count in subdirectories in a time interval

by crazy-duck (Novice)
on Apr 29, 2014 at 15:54 UTC ( #1084344=perlquestion: print w/replies, xml ) Need Help??
crazy-duck has asked for the wisdom of the Perl Monks concerning the following question:

Hi Team We are extracting the tar file count against each subdirectories and writing it to a log file, However we need to run this from 6am EST to 11 PM EST, how can this be incorporated in a perl script

below is the command and output

find /home/many -type d -exec sh -c "fc=\$(find '{}' -type f -name "* +.tar" -type f -mmin +20 -type f | wc -l); echo -e \"\$fc\t{}\"" \; | +sort -nr 3 /home/many 1 /home/many/t3 1 /home/many/t2 1 /home/many/t1
  • Comment on Perl script to find the file count in subdirectories in a time interval
  • Download Code

Replies are listed 'Best First'.
Re: Perl script to find the file count in subdirectories in a time interval
by karlgoethebier (Monsignor) on Apr 29, 2014 at 16:32 UTC

    I'm unsure about what you want to do. Do you want to port your shell stuff to Perl? Or do you want to wrap it into some Perl script? Can't you cron your shell stuff? Or do you want to schedule it using Perl? And so on...please provide some more details.

    Best regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

Re: Perl script to find the file count in subdirectories in a time interval
by graff (Chancellor) on Apr 30, 2014 at 02:38 UTC
    The shell-command example would make more sense to us if you put code tags around it (<c>…</c>).

    As indicated in the first reply above, your question is not clear. What have you tried in perl so far?

    In terms of a perl script that gathers and reports information about quantities of things in a directory structure, you might want to look at a tool I posted here a while back: Get useful info about a directory tree -- it has command line options for specifying a date range of interest.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1084344]
Approved by mr_mischief
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2018-10-21 19:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...














    Results (119 votes). Check out past polls.

    Notices?