> Hi!
Howdy!
>
> Im gonan try to help you, cause Im doing the same. Getting
> certain files from
> a FTP Server, saving them in a directory already defined,
> unziping them in a
> temp directory, parsing the file (thanks to all the list),
> and saving some
> data to a MySql DataBase.
Cool thanks!
> However, after all this, I check with File::MMagic, if those
> were really Zip
> Files, if a file just have the ext of zip but its not a Zip
> File I remove it.
Good idea.
>
> > Now heres' where my perl script comes in:
>
> > Perl/Archive::Zip (or other module???)
> Yes.. Archive::Zip
> Its easy, Cause I dont know if the files that are inside the
> zip will appear
> in a directory, Im going to unzip it in a Directory with the
> same name of the
> Zip (obvious, remove the .zip ext), but You could do it with basename.
>
> sub descomprimir_zip {
> my $this = shift;
> #Lenght of the File
> my $letrasarchivo = length($this->{FILE_ZIP});
> #extract the name, before the .zip or .ZIP
> my $this->{FILE_SZIP} = substr($file, 0,
> $letrasarchvio-4); #Create the directory where Im going to unzip it
> my $this->{DIR_DESCZIP} = $dir_desczip =
> $this->{CONFIG_DIRPRINCIPAL}."/".$_[0]."/".$this->{FILE_SZIP};
> #Wheres the f*** zip fIle?
> my $dir_pathzip =
> $this->{CONFIG_DIRPRINCIPAL}."/".$this->{CONFIG_DIRRECEP};
> #Create the $zip object
> my $zip = Archive::Zip->new();
> #Where is the file?
> $zip->read($dir_pathzip."/".$this->{FILE_ZIP});
> #Unzip it in $this->{DIR_DESCZIP}, Im adding a /, so $zip,
> knows that it will
> be a directory.
> $zip->extractTree('', $this->{DIR_DESCZIP}."/");
> #Exit of Zip, just undef $zip (its not necessary)
> $zip = undef;
> }
>
I guess I'm a bit lost as to where $this->{WHATEVERS} gets created and where and how
you call descomprimir_zip();
All I need to do is extract one file from one zip file
into one text file all in the current directory.
Would this do it?:
my $zip = Archive::Zip->new(); # creat new object
$zip->read("./data.zip"); # put the zip file in the object
$zip->????("./data.txt"); $ put txt file in data.zip into data.zip
undef $zip; # finish
TIA
Dan
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]