justin423 has asked for the wisdom of the Perl Monks concerning the following question:
It is zipping all of them into just one file and I know it must be something simple that I am missing.
#!/usr/bin/perl use IO::Compress::Zip qw(:all); $path='/DATA/DOCUMENTS/'; opendir my $dh, $path; my @files = readdir $dh; foreach my $files (@files){ print "$files\n"; $zipfilename=substr($files,7); $zipfilename1=$path.$zipfilename; zip [ glob("$zipfilename1*.pdf") ] => "$zipfilename1.zip" or die "Cannot create zip file: $ZipError" ; } closedir $dh;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Zipping the contents of a directory by filename
by choroba (Cardinal) on May 29, 2025 at 15:32 UTC | |
by justin423 (Scribe) on May 29, 2025 at 15:42 UTC | |
by hsmyers (Canon) on Jun 02, 2025 at 20:30 UTC | |
Re: Zipping the contents of a directory by filename
by Fletch (Bishop) on May 29, 2025 at 15:48 UTC | |
Re: Zipping the contents of a directory by filename
by karlgoethebier (Abbot) on Jun 01, 2025 at 06:14 UTC | |
by jeffenstein (Hermit) on Jun 02, 2025 at 13:09 UTC | |
by karlgoethebier (Abbot) on Jun 02, 2025 at 15:29 UTC |