Hello, I have a directory with the following structure: nas\data\nonops\common\engine\ingest\sim\mkv\ap0000->files
\ap0001->files
…………..
\ap1335->files
For archiving purposes, I need to create a zip file at the end of tests (when the apxxxx folders are populated). This is my current code. It copies all the directories under nas\data\nonops\common\engine\ingest\sim\mkv into the destination, then creates one zip file out of all of that. The issue is that there is so much data total in all the sub-directories that it is too big to make one zip file. I need to be able to create a separate zip file for each apxxxx file, ideally naming each zip file as apxxxx.zip.
use strict; use warnings ‘all’; use File::Copy::Recursive; use Archive::Zip; use constant AZ_OK =>0; my $mkvingestdir = “//nas/data/nonops/common/engine/ingest/sim/mkv”; my $mkvingestdest = “//nas/shared/group/test/mkv/ingest”; File::Copy::Recursive::dircopy $mkvingestdir, $mkvingestdest or die “C +opy failed: $!\n”; my $mkvingestzip = Archive::Zip->new(); my $mkvingestzipdest = “//nas/shared/group/test/mkv”; $mkvingestzip ->addTree($mkvingestdest); if ($mkvingestzip->writeToFileNamed(‘ingest.zip’) != AZ_OK) { print “Error in archive creation!\n”; } else { print “Archive created successfully!\n”; }
I’m thinking a foreach loop would work? I’m not 100% sure how to go about getting to my end goal. The script above works, but will not work when a full test is ran and there is 10 – 20 GB of data total in the /mkv directory. Any help would be greatly appreciated!
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |