try the unlink command.
Stéphane JEAN BAPTISTE wrote:
How can I delete a file ?
thanks
unix:
rm filename
winblows:
del filename
oh wait, do you mean in perl ;) (wise a$$ arent I?)
perldoc -f unlink
-Original Message-
From: Stéphane JEAN BAPTISTE
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 21, 2001 10:03 AM
To: PERL
Subject: to delete a file
How can I
Hi,
Usually, one uses the following command (from the shell prompt)
rm /path/to/file/filename
To supress the confirmation message, use:
rm -f /path/to/file/filename
To delete recursively (i.e. a directory), and make it verbose to the screen:
rm -rfv /path/to/directory
Does that help.
Of
On Thu, Jun 21, 2001 at 03:04:21PM +0100, n6tadam
([EMAIL PROTECTED]) spew-ed forth:
Hi,
[snip]
Of course, from a perl script, you can either use:
system(/bin/rm -f /path/to/filename);
or
`rm -f filename`
Don't do that. Just use unlink()
perldoc -f unlink
Cheers,
Kevin
--
It's allright!
thank you
Stéphane JEAN BAPTISTE a écrit :
How can I delete a file ?
thanks
To delete a file:
unlink($filename) or die can't delete $filename:$!\n;
To delete lots of files:
unlink(@filenames) == @filenames or die couldn't unlink all of @filenames: $!\n;
To delete a folder:
use File::Path;
rmtree($directory);
Stéphane JEAN BAPTISTE [EMAIL PROTECTED] 06/21/01
03:03pm
#!/usr/bin/perl
#
# Name:unlinkdemo.pl
# Author: Chris Hedemark [EMAIL PROTECTED]
# Purpose: Demonstrate use of the unlink function.
if (!@ARGV) {
die No arguments!\n;
}
for ($i = 0; $i @ARGV.; ++$i) {
if (-e $ARGV[$i]) {
unlink ($ARGV[$i]);
}
else {
print File $ARGV[$i]
it will
run faster with less resource overhead.
- Original Message -
From: n6tadam [EMAIL PROTECTED]
To: Stéphane JEAN BAPTISTE [EMAIL PROTECTED];
PERL [EMAIL PROTECTED]
Sent: Thursday, June 21, 2001 10:04 AM
Subject: Re: to delete a file
Hi,
Usually, one uses the following command (from