Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, I am trying to extract some files on a diffrent machine through Perl, but i am not able to do that. Please suggest.
#!/usr/bin/perl use Net::FTP; use Archive::Zip; use IO::File; my $zipname = 'C:\Documents and Settings\nt\Desktop\Servers.zip'; my $destinationDirectory = '\\10.150.1.240\d$\Logs'; my $zip = Archive::Zip->new($zipname); foreach my $member ( $zip->members ) { next if $member->isDirectory; ( my $extractName = $member->fileName ) =~ s{.*/}{}; $member->extractToFileNamed("${destinationDirectory}/${ext +ractName}"); } printf "unzip done\n";
I am able to extract the files through Winzip at the location.

Replies are listed 'Best First'.
Re: Unzip to a diffrent machine
by Corion (Patriarch) on Mar 15, 2011 at 15:25 UTC

    $destinationDirectory does not contain what you think it does. Print it out, then read perlop to see what you need to change.

Re: Unzip to a diffrent machine
by cdarke (Prior) on Mar 15, 2011 at 15:54 UTC
    my $zipname = 'C:\\Documents and Settings\\nt\\Desktop\\Servers.zip'; my $destinationDirectory = '\\\\10.150.1.240\\d$\\Logs';