in reply to Re: Moving log files, create folder based on local time/date & zip them up based on local time & date.
in thread Moving log files, create folder based on local time/date & zip them up based on local time & date.

Hi Mike, No I haven't tried the Archive::Zip module. Can I take all the logs in that directory, zip it up and name it based on local time and date with this module? Is so can you give me some example... thanks, anthony
  • Comment on Re: Re: Moving log files, create folder based on local time/date & zip them up based on local time & date.

Replies are listed 'Best First'.
Re: Re: Re: Moving log files, create folder based on local time/date & zip them up based on local time & date.
by charnos (Friar) on Sep 09, 2002 at 19:32 UTC
    opendir FILES, $dir_name; my @files = readdir FILES; closedir FILES; my $zip = Archive::Zip->new(); $zip->addFile($_) for @files; my $date = join "_", ((localtime)[3,4,5]); my $status = $zip->writeToFileNamed( "$date.zip" );
Re: Re: Re: Moving log files, create folder based on local time/date & zip them up based on local time & date.
by mjeaton (Hermit) on Sep 09, 2002 at 19:31 UTC
    Well, you could either loop through the contents of the directory and use the addFiles method or you could use Archive::Tree. The docs for this module are pretty good and have good examples throughout.

    As long as you're just talking about naming the zip file based on the date and time, the code from my earlier node should cover that.

    mike