kiwi_bris_ct has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks, I have copied 2 files from 1 volume to another, renamed on the way with date attached to name. I want to create a log file that I can query with any date and if file is over 300kb, to notified me. Please find the following script so far.
use strict; use File::Copy; use POSIX; my @files = ('system.csv', 'sales.csv'); my $home = 'c:/EOD/20 January 2002/'; my $archive = 'y:/New EOD/'; my $yesterday = strftime("%d%m%y", localtime(time - 24*60*60)); for (@files){ copy $home.$_, "$archive${yesterday}_$_" or print "ERROR: Can't copy $_ : $!\n"; }

Replies are listed 'Best First'.
Re: log file
by atopolc (Pilgrim) on Apr 26, 2002 at 12:52 UTC
    Be aware that 2 days out of the year your  $yesterday will be incorrect. See  perldoc -q yesterday Also you may want to use  stat to get your file sizes. See  perldoc -f stat for proper usage.
Re: log file
by perlplexer (Hermit) on Apr 26, 2002 at 13:40 UTC
    Requirements that you posted are not clear at all.
    - what is the preferred log file format?
    - when you say "if file is over 300kb", which file(s) are you talking about? The individual files that you copy? The log file?
    - how do you want to be "notified" ?

    What have you tried, btw?
    The code above is the exact copy of what I gave you a few days ago.
    You don't expect monks to write everything for you, do you?

    --perlplexer
    A reply falls below the community's threshold of quality. You may see it by logging in.