Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Redirecting location in perl

by Anonymous Monk
on Jan 10, 2013 at 06:50 UTC ( #1012600=perlquestion: print w/replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi I am actually doing a script to unzip .gz files .The script is given below

use IO::Uncompress::Gunzip qw(gunzip $GunzipError); $input="file.dat.gz"; $output="file.dat"; if (-e $input) { gunzip $input => $output or die "gunzip failed: $GunzipError for $output\n"; }

This will work if the input and code are in same location.My requirement is my script should be in "C" drive and input should be in D drive.Can anyone help ?

Replies are listed 'Best First'.
Re: Redirecting location in perl
by pmqs (Pilgrim) on Jan 10, 2013 at 13:42 UTC
    Have you tried including the path in the gunzip command, like this?
    gunzip "c:/somepath/$input" => "d:/anotherpath/$output"
Re: Redirecting location in perl
by LanX (Bishop) on Jan 10, 2013 at 07:23 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1012600]
Approved by vinoth.ree
help
Chatterbox?
[holli]: Corion: 25$ deposit bottle from Lidl :)
[holli]: bullshit. cents not $
[ambrus]: holli: wait, plastic or glass bottle?
holli switches OS
[holli]: Lidl only sells plastic
[Corion]: holli: Oooh, a twister top - so yes, that's a worse state of mind than it sounded ;)
[holli]: and since I outed myself anyway as a horrible person, to top it off, the bottle contains beer. alcohol free beer
[Discipulus]: nowaday such beers have also a good taste

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (14)
As of 2017-09-25 12:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (280 votes). Check out past polls.

    Notices?