Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using tar in windows

Status
Not open for further replies.

peterneve

Programmer
Jan 24, 2002
50
GB
I have written a script which upload a tar file. The next step is to untar it. I have tried:

Code:
$com="tar -xf \"$savefile\"";
system("$com");

and

Code:
$com="tar -xf \"$savefile\"";
open (TEST, "$com");
close TEST;

both of which just hang. The tar file is extracted (with the first option) but the rest of the page is never displayed on the browser.

I am using windows and active perl and the tar.exe is one that comes with exceed...

Any ideas?

Thanks in advance

 
Get your tar command to work on the command line first. Assuming the working command is:

tar -xf "mysavefile"

Code:
$com = 'tar -xf "mysavefile"';
system("$com");

or

Code:
$savefile = "mysavefile";
$com = 'tar -xf "$savefile"';
system("$com");

should both work.

-Nick
 
Try wrapping the entire command (including double quotes) in the qq function, e.g.,
Code:
$savefile = "mysavefile";
$com = qq("tar -xf $savefile");
$result = system($com);
 
Hi, thanks for all the responses.

I have found that the problem was simply that the tar program that the system defaulted to was a windows program, which never closed after finishing it's operation, so Perl was waiting for it to finish forever. My original code works now that a DOS tar program is being used.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top