Nov 23, 2017, 2:19 PM
Post #1 of 7
How to Zip files and directories?
Happy Thanksgiving everybody!
I hope all well today and everyone will have a good meal in peace and with your family and friends.
Any way back to busyness....
I have a problem zipping files.
I'd like to Zip some files in some Dirs, not all files but particular files from a directory.
I checked Google already there are a lot of examples of something I do not need and no clear one on how to use IO::Compress::Zip
I found documents about the IO module but it is like reading Latin.
It is like they are trying to make everything complicated for some reason and I'm pretty sure it is not and can be written in human language.
Here is the code, I tried to make changes to it but it still zipps the whole directory "H:/Sixshot_logs/Unit_oDay.zip".
Thank you in advance!
use strict ;
use warnings ;
use IO::Compress::Zip qw(:all);
my $unit_zippedfile = "H:/Sixshot_logs/Unit_oDay.zip" ;
my $unit_tozip = 'H:/Sixshot_logs/Unit.txt' ;
zip "H:/Sixshot_logs/Unit.txt" => "$unit_zippedfile"
or die "zip failed: $ZipError\n";