For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > June 2006 > Re: Handle date structured folders - CORRECTIO









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Handle date structured folders - CORRECTIO
John Ackley

2006-06-24, 8:01 am

argument 2 of DateCalc() should be "$days days ago" NOT "$days ago"
sorry

John Ackley wrote:
>
>
> Khairul Azmi wrote:
> assuming, as you state, "erase log files" (not directories)
> assuming 2 days prior as per your example
> assuming all earlier log files
> try this which is easy to modify if assumptions are not correct
>
>
> #! /usr/bin/perl
>
> use strict;
> use warnings;
>
> use Date::Manip;
>
> my $directory;
> my $days = 2;
> while( -d
> ($directory =
> UnixDate(DateCalc('today',"$days ago"),
> '/var/log/projects/%Y/%m/%d')) ) {
> unlink "$directory/*";
> $days++;
> }
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com