RE: Multiple file Delete

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



That error message is oki, but use @ to silent error messag, like

      if (@unlink($delFile))



-----Original Message-----
From: Lenny Davila
To: php-windows@xxxxxxxxxxxxx
Sent: 16-6-2004 22:07
Subject:  Multiple file Delete

I need to be able to delete multiple files from my web server by
choosing
one file.  I have a directory of thumbs named "images" and a directory
called "big" with text files and Full images.  If I was to delete the
file
"image1.jpg" I want it to delete "image1.jpg" in the images, the big
folder
and "image1.jpg.txt" in the big folder.  I have now in my code.
($file = file to be deleted)

   if($action=="dele" && $confirm==1) {
   $match=array(); 
// Create an array of files
  $match[]=$file; 
// Put filename in the array
   
  $dirHandle = dir('../'); 
// get recursive directory listing from the directory above
  while($fileHandle = $dirHandle->read()) { 
// while reading the directory
    $delFile = strrchr($fileHandle, "/"); 
// get the filename after the last "/"
    if (in_array(substr($delFile,0,5), $match)) { 
// this line compares the 5 first chars in the filename 
// with the names in the $match array 
// Next line is line 36
    unlink($delFile); $action="";} 
// delete all files that match the filename
      if (unlink($delFile)) { 
          echo "Removed the file $fileHandle<br> \n"; 
      } 
    } 
  }

The first error I get:
Warning: unlink(): No such file or directory in
/home/www/mathiu1i/php/gallerie/edit2.php on line 36


TIA
------------------------------------
Eleno Davila
lenny@xxxxxxxxxxxxxxxxxx
(877)933-6750 Ext 163 (direct line)
http://plasticsurgery.com ;

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux