Re: unlink ($files);

From: Date: Wed, 08 Jan 2003 07:14:11 +0000
Subject: Re: unlink ($files);
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-130716@lists.php.net to get a copy of this message
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hey, You can't delete the files all at once....you have to delete them one by one or use this function that will remove full directories. - ----- function force_rmdirs($dir) { $dh = opendir($dir); while(false !== ($file = readdir($dh))) { if($file != '.' && $file != '..') { $path = $dir .'/'. $file; if(is_dir($path)) { force_rmdirs($path); } else { unlink($path); } } } closedir($dh ); return rmdir($dir); } - ----- HTH! ~Paul On Wednesday 08 January 2003 12:29 am, rw@xend.net wrote: > Ok, Jason, here's another one! > > I think I've read how to delete a file. > I need to delete 25 files, then do a rmdir(blah); > > Line 16: $directory = "path/*.*"; > Warning: Unlink failed (No such file or directory) in > /mnt/ls6/17/169/00000000/htdocs/2003/_admin/del_listing_action.php on line > 16 > > Warning: RmDir failed (File exists) in > /mnt/ls6/17/169/00000000/htdocs/2003/_admin/del_listing_action.php on line > 17 > > Thanks - -- ~Paul Nicholson Design Specialist @ WebPower Design paul@webpowerdesign.net www.webpowerdesign.net "The web....the way you want it!" "It said uses Windows 98 or better, so I loaded Linux!" Registered Linux User #183202 using Register Linux System # 81891 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE+G8/JDyXNIUN3+UQRAmd/AJ42CW5HDYEQ1dvf/m5CLynoqGekwgCdE5T2 rxlRjVBaFNIhQGFQc38ylks= =mJq1 -----END PGP SIGNATURE-----

« previous php.general (#130716) next »