Fw: [PHP] unlink ($files);

From: Date: Thu, 09 Jan 2003 22:59:36 +0000
Subject: Fw: [PHP] unlink ($files);
Groups: php.general 
Request: Send a blank email to php-general+get-131013@lists.php.net to get a copy of this message
Hi, You can use the backtick operator to delete whatever you have permissions to delete: $directory = "path/*.*"; rm -rf $directory; They aren't quotes, they are backticks (to the left of the 1 key on most keyboards). It is very useful for any command line stuff you have permissions to do. Brian Allen brian@gzmarketing.com "Paul Nicholson" <paul@webpowerdesign.net> wrote in message news:<200301080714.h087EZr11022@WPD01.network.webpowerdesign.net>... > -----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 (#131013) next »