Re: I want a perl script for?
- From: orasnita@xxxxxxxxx (Octavian Rasnita)
- Date: Wed, 30 Apr 2008 20:58:32 +0300
From: "Vinayak dutt" <vinayak.dutt@xxxxxxxxx>Am vinayak here.
As am new to Perl and their is a requirment which says -
1. There exists a .zip which contains folders and file.
2. Search for 'makefile' in the respective folders and store them in a text
file.
3. And search for .c files in them and list them in separate text file.
4. Then the files that exists other than .c files should be removed from the
dir.
From which dir? You only have files in a zip archive.
Here is a perl program that reads a zip archive, extracts the makefile and ..c files, then delete the other files from the archive (if this is what you wanted to say by "from the dir").
Octavian
use strict;
use Archive::zip;
my $zip = Archive::Zip->new('lucru.zip');
my @files = $zip->memberNames;
foreach my $file(@files) {
if ($file eq 'makefile' or $file =~ /\.c$/) {
$zip->extractMember($file);
}
else {
$zip->removeMember($file);
}
}
$zip->overwrite;
.
- References:
- I want a perl script for?
- From: Vinayak dutt
- Re: I want a perl script for?
- From: Jenda Krynicky
- I want a perl script for?
- Prev by Date: Re: perl source code encryption
- Next by Date: Array element split, with grep
- Previous by thread: Re: I want a perl script for?
- Next by thread: Array element split, with grep
- Index(es):
Relevant Pages
|
|