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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help for this perl script

Status
Not open for further replies.

biobrain

MIS
Joined
Jun 21, 2007
Messages
90
Location
GB
#!/usr/bin/perl -w

system ("perl spd.pl");

system ("gunzip xyz.aa.gz");

exit;

Here 2nd system call will generate a unzip file xyz.aa now i want that if any other file already exist in the folder it should be overwritten without asking any user input

what flag i need to use with gunzip so that it should overwrite the existing file xyz.aa automatically.

regards

 
Have you tried man gunzip?

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::PerlDesignPatterns)[/small]
 
i have seen man gunzip sorry i am unable to understand
 
Code:
[url=http://perldoc.perl.org/functions/unlink.html][black][b]unlink[/b][/black][/url] [red]'[/red][purple]xyz.aa.gz[/purple][red]'[/red][red];[/red]

- Miller
 
What I meant was you type in the command man gunzip on your terminal, and it tells you the syntax of the gunzip command. From which you could establish that
-f --force
Force compression or decompression even if the file has multiple links or the corresponding file already exists, or if the compressed data
is read from or written to a terminal. If the input data is not in a format recognized by gzip, and if the option --stdout is also given,
copy the input data without change to the standard ouput: let zcat behave as cat. If -f is not given, and when not running in the back-
ground, gzip prompts to verify whether an existing file should be overwritten.
is the option you want
Code:
system("gunzip -f  xyz.aa.gz");

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::PerlDesignPatterns)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top