PHP rmdir Delete file directory code

Source: Internet
Author: User

PHP rmdir Delete file directory code

Class Del_path
{
function Wm_chief_delpath ($del _path)
{
if (!file_exists ($del _path))//The target directory does not exist is established
{echo ' Directory not found. '; return false;}
$hand = @opendir ($del _path);
$i = 0;
while ($file = @readdir ($hand))
{$i + +;
if ($file!= "." && $file!= "...")
{
Directory
if (Is_dir ($del _path.) /". $file))
{
$del _s_path= $del _path. " /". $file;
$this->wm_chief_delpath ($del _s_path);
}
Else
{
$del _file= $del _path. " /". $file;
$this->wm_chief_file ($del _file);
}
}
}
@closedir ($hand);
$this->wm_chief_path ($del _path);
return true;
}
deleting files
function Wm_chief_file ($del _file)
{
@unlink ($del _file);
}
Delete Directory
function Wm_chief_path ($del _path)
{
@rmdir ($del _path);
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.