简体   繁体   English

从ZIP存档导出文件列表而无需解压缩

[英]Export file list from ZIP archive without unzipping

I have hundreds of ZIP archives and each of them contains 2000 to 4000 xml files in it. 我有数百个ZIP存档,每个存档中都包含2000到4000个xml文件。 Now I need some way to get a text file that will contain list of these xml files or at least file counts from each archive. 现在,我需要某种方式来获取一个文本文件,该文件将包含这些xml文件的列表,或者至少包含每个存档中的文件数。

Is there any application to do this, or can I do this through cmd or perl? 有任何应用程序可以执行此操作,还是可以通过cmd或perl进行此操作?

I am not an expert programmer 我不是专业程序员

Archive::Zip can be used to read a zip file and it's members. Archive::Zip可用于读取zip文件及其成员。

The module includes an examples directory that has a lot of useful scripts showing how to use the module. 该模块包括一个examples directory ,其中包含许多有用的脚本,这些脚本显示了如何使用该模块。

Something like this: 像这样:

#!/usr/bin/perl
use strict;
use warnings;

use Archive::Zip;

my $archive_name = "archive.zip";

my $archive_extract = Archive::Zip -> new ( $archive_name );
foreach my $member ( $archive_extract -> members() )
{
  print $member -> fileName(),"\n";
}

You will, of course, need to supply your own directory search. 当然,您将需要提供自己的目录搜索。 I would recommend looking at File::Find for that 我建议您查看File::Find

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM