Thanks,
Thats the point, I wanted to confirm.
Sara.
- Original Message -
From: "Wiggins d Anconia" <[EMAIL PROTECTED]>
To: "Sara" <[EMAIL PROTECTED]>; "beginners-cgi"
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thurs
Here is one way, there are probably more elegant ways out there:
opendir DIR,"/home/path/to/dir";
@list = readdir DIR;
foreach $file (@list) {
unlink $file if $file =~ m/\.bak$/;
}
closedir DIR;
-Original Message-
From: Sara [mailto:[EMAIL PROTECTED]
Sent: October 29, 2003 1
Sara,
You're unlink() statement is correct and should work fine. What errors, if
any, are you getting?
Anthony
- Original Message -
From: "Sara" <[EMAIL PROTECTED]>
To: "beginners-cgi" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, October 29, 2003 12:44 PM
Subject: unlink
Another way ...
opendir REMOVEIT, $dir or die "Open Failed";
my @gone = grep /\.bak$/ , map "$dir/$_". readdir REMOVEIT;
closedir REMOVEIT;
print "Remove ", join(',', @gone), "? :";
my $cnt;
if (<> =~ /y/i) {
$cnt = unlink @gone;
print "Removed $cnt files from $dir ending in .bak\n" if (
>
> unlink <*.bak>;
>
> how I am supposed to specify directory above?
>
> for example I have to apply above unlink command to delete all backup
files in the Specified directory.
>
> $dir = /home/path/to/dir
>
> is it right?
>
> unlink <$dir/*.bak>;
>
> ??
>
> Any ideas?
>
The <> operato