So, I initially tried Stevieb's suggestion. It created the zip files, but there were no files inside the zip. So, I started playing. Again, I'm getting the zip files created, with the correct names, but there are no files inside the zips. Here is the latest attempt that I made at this:
use strict; use warnings ‘all’; use File::Copy::Recursive; use Archive::Zip; use constant AZ_OK =>0; use File::Basename; use File::Find::Rule; my $mkvingestdir = “//nas/data/nonops/common/engine/ingest/sim/mkv”; my $mkvingestdest = “//nas/shared/group/test/mkv/ingest”; my @dirs = File::Find::Rule->directory() ->in($mkvingestdir); my @files; foreach my $dir (@dirs) { @files = glob "*.eap"; my $mkvingestzip = Archive::Zip->new(); foreach $_ (@files) { $mkvingestzip->addFile($_); } my $name = basename $dir; if ($mkvingestzip->writeToFileNamed("$mkvingestdest/${name}.zip") + != AZ_OK) { print "Error in archive creation\n"; next; } print "Archive created successfully!\n"; }
In reply to Re^2: Create zip files for each sub-directory under a main directory
by mrd1019
in thread Create zip files for each sub-directory under a main directory
by mrd1019
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |