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 (Abbot) 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.