Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Do you have a specific question? The following code works perfectly fine on Win32:</p> <pre><code>#!/usr/bin/perl use strict; use warnings; use Archive::Zip; use File::Find; my $zip = Archive::Zip-&gt;new; find(\&amp;wanted, $ENV{TEMP}); $zip-&gt;writeToFileNamed('test.zip'); sub wanted { return unless /\.txt$/; $zip-&gt;addFile($File::Find::name); } </code></pre> <p>Let's run it:</p> <pre> C:\Temp> arc C:\Temp> unzip -l test.zip Archive: test.zip Length Date Time Name -------- ---- ---- ---- 240 10-16-09 19:19 /Temp/cpan_install_Wb7z.txt 2401 10-18-09 23:09 /Temp/perldoc_perlfunc_T4adbd85e_aec9c.txt 2401 10-18-09 23:09 /Temp/perldoc_perlfunc_T4adbd872_bc437.txt 2718 10-19-09 10:04 /Temp/perldoc_perlfunc_T4adc71e7_f4c64.txt 2718 10-19-09 10:04 /Temp/perldoc_perlfunc_T4adc71f2_bf08d.txt 2718 10-19-09 10:04 /Temp/perldoc_perlfunc_T4adc720a_a5c6a.txt 29188 10-19-09 10:05 /Temp/perldoc_perlfunc_T4adc7226_bd834.txt 6949 10-20-09 17:31 /Temp/perldoc_perlfunc_T4ade2c1f_d0cf8.txt 6949 10-20-09 17:32 /Temp/perldoc_perlfunc_T4ade2c50_f2040.txt 106763 10-19-09 10:00 /Temp/perldoc_perlop_T4adc7103_f4cab.txt 67948 10-18-09 23:07 /Temp/perldoc_perlvar_T4adbd7d7_d8cda.txt -------- ------- 230993 11 files </pre> <p>Ditto for <code>Archive::Tar</code>.</p> <p><strong>Update:</strong> To clear up any doubt that the files were added to the archive with the correct path, note:</p> <pre> C:\Temp> dir *.txt Volume in drive C is **** Volume Serial Number is ****-**** Directory of C:\Temp 2009/10/16 07:19 PM 240 cpan_install_wb7z.txt 2009/10/18 11:09 PM 2,401 perldoc_perlfunc_t4adbd85e_aec9c.txt 2009/10/18 11:09 PM 2,401 perldoc_perlfunc_t4adbd872_bc437.txt ... </pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload