WindowsXPã§ã¯æ¨æºè£
åã§ãZIPã§ã®å§ç¸®/解åæ©è½ãããã¾ãã・・・ã
Perlã§ãæ¨æºã¢ã¸ã¥ã¼ã«ï¼Archiveï¼ã§ãZIPã§ã®å§ç¸®/解åæ©è½ãããã¾ãã
ç°¡åãªãµã³ãã«ãçµãã§è¦ã¾ããã®ã§ãä½ãã®æ©ä¼ã«åèã«ãªãã°å¹¸ãã§ãã
âZIPå§ç¸®ãµã³ãã«ï¼zip.plï¼
use strict; use warnings; use Archive::Zip; my $zip_file = 'file.zip'; my $zip = Archive::Zip->new(); $zip->addFile('data/file.txt'); $zip->addFile('data/file2.txt'); $zip->addTree('aaa', 'aaa'); $zip->addTree('bbb', 'ccc'); $zip->addTree('./a/b/c', 'd'); $zip->writeToFileNamed($zip_file);
addFileã¯å¼æ°ã®ãã¡ã¤ã«ããaddTreeã¯ç¬¬ï¼å¼æ°ã®ãã©ã«ããZIPå§ç¸®ãã¾ãã
ã¡ãªã¿ã«ãaddTreeã®ç¬¬ï¼å¼æ°ã¯è§£åãããæã®ãã©ã«ãåãæå®ãã¾ãã
å§ç¸®ã¯ãå¼æ°ã§æå®ãããã¡ã¤ã«ããã©ã«ãããããã©ã«ãå
ã§zip.plãå®è¡ãã¾ãã
âZIP解åãµã³ãã«ï¼unzip.plï¼
use strict; use warnings; use Archive::Zip; my $dir = '.'; my $zipfile = "$dir/file.zip"; my $zip = Archive::Zip->new($zipfile); my @members = $zip->memberNames(); foreach (@members) { $zip->extractMember($_, "$dir/$_"); }
解åã¯ãfile.zipãããåããã©ã«ãå
ã§unzip.plãå®è¡ãã¾ãã