Need a script to move files where their last mod date <= 'xx MMM yyyy'

Evan evan_lsa at internode.on.net
Fri Nov 17 07:06:24 CST 2006


Geoffrey
I just tried that - it gives me the same results :(


Geoffrey D. Bennett wrote:
> On Fri, Nov 17, 2006 at 02:18:37PM +1030, Evan wrote:
> [...]
>   
>> List further to this query I came up with the following block of code 
>> pieced together from googling etc
>> It unfortunately doesn't work based on the output im seeing. Can anyone 
>> help.
>>     
> [...]
>   
>> $dir="/var/log/copfilter/default/opt/proxsmtp/quarantine";
>>    opendir(BIN, $dir) or die "Can't open $dir: $!";
>>    my $cnt = 0;
>>    foreach my $file (grep {/\./} sort by_last_mod  readdir BIN){
>>     
> [...]
>   
>> sub by_last_mod {
>>  # vars $a and $b automatically passed in
>>  # perl function 'stat' returns array of info on a file
>>  # 10th element of the stat array is last modified date,
>>  # returned as number of seconds since 1/1/1970.
>>  my $adate = (stat(a))[10]; # get last modified date
>>     
>
> Shouldn't that be stat("$dir/$a") ?
>
>   



More information about the linuxsa mailing list