Cerca articolo o scritps su sastgroup.com
es: banca sella

Discuti il tutorial sul forum !

Come eliminare una directory con php

< ?php
function delete_directory($dir)
{
if ($handle = opendir($dir))
{
$array = array();

while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {

if(is_dir($dir.$file))
{
if(!@rmdir($dir.$file)) // Empty directory? Remove it
{
delete_directory($dir.$file.'/'); // Not empty? Delete the files inside it
}
}
else
{
@unlink($dir.$file);
}
}
}
closedir($handle);

@rmdir($dir);
}

}

$dir = '/home/path/to/mysite.com/folder_to_delete/'; // IMPORTANT: with '/' at the end

$remove_directory = delete_directory($dir);
?>

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • del.icio.us
  • De.lirio.us
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Reddit
  • scuttle
  • Smarking
  • Spurl
  • YahooMyWeb
  • DZone
  • Internetmedia
  • Snap2r
  • Technorati


Correlati


Commenti

Scrivi un commento





Commenti recenti:


Ultimi dal forum