lisaw has asked for the wisdom of the Perl Monks concerning the following question:
Any suggestions on how to remove multiples files instead of just one at a time? Thanks! Lisawread(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs=split(/&/,$buffer); foreach $pair (@pairs) { ($name, $value)=split(/=/,$pair); $value =~ tr/+/ /; $value=~s/%(..)/pack("c",hex($1))/ge; $f{$name}=$value; chomp($f{$name}); } print "<tr><td bgcolor=#CCCCCC><b> File Removal</b></td></tr></ta +ble>"; if(($f{'action'} eq "delete")&&(open(FILE,$f{'file'}))){ unlink($f{'file'})||print "<h1>Could Not Delete: ".$f{'file'}."</h +1>"; } $dir=$f{'dir'} if $f{'password'} eq $password; opendir(DIR,$dir); @files=readdir(DIR); closedir(DIR); @files=sort(@files); print "Directory Content:"; $i=0; foreach $file(@files){ if((!opendir(TEST,$dir."/".$file))&&($f{'password'} eq $password)& +&($file ne ".")&&($file ne "..")){ $i++; print "<input type=checkbox name=file value=\"".$dir."/".$file +; if($i==1){ print "\" checked>"; }else{ print "\">"; } print $file."<BR>\n"; } } print "<input type=hidden name=dir value=\"".$location."\">\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Deleting Multiple Files
by shemp (Deacon) on Jun 04, 2003 at 21:19 UTC | |
by grinder (Bishop) on Jun 04, 2003 at 21:44 UTC | |
by shemp (Deacon) on Jun 04, 2003 at 21:57 UTC | |
by lisaw (Beadle) on Jun 05, 2003 at 01:41 UTC | |
by jdporter (Paladin) on Jun 05, 2003 at 03:54 UTC |