Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: Create zip files for each sub-directory under a main directory

by hippo (Bishop)
on Nov 29, 2016 at 21:24 UTC ( [id://1176855]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Create zip files for each sub-directory under a main directory
in thread Create zip files for each sub-directory under a main directory

foreach my $dir (@dirs) { @files = glob "*.eap"; my $mkvingestzip = Archive::Zip->new(); foreach $_ (@files) { $mkvingestzip->addFile($_); }

I think that your problem here is that you are performing the glob in the $CWD which is not $dir and therefore it isn't matching. You could confirm this by adding diagnostic print statements like this:

foreach my $dir (@dirs) { print "Now processing dir $dir\n"; @files = glob "*.eap"; my $mkvingestzip = Archive::Zip->new(); foreach $_ (@files) { print "Adding file $_\n"; $mkvingestzip->addFile($_); }

You will likely see the "dir" diagnostics but no "file" ones. In that case you'll need either to chdir inside the outer loop or else prepend the path to the glob argument.

Printing diagnostics like this is item number 2 on the Basic debugging checklist.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1176855]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-25 14:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found