这是一个文件目录移动类,只要在listDir写你的要转移文件的目录名移就可以了,这个文件夹与文件移动类,比较适合采集下载的多文件操作,如要在打包文件里面加说明,等哦。
die();
class s{
//var $path ='flash';
var $htm ='/index.htm';
var $html='/index.html';
var $ladir='/111cn.net教程';
public function full_copy( $source, $target )
{
if ( is_dir( $source ) && $source != $source.$this->ladir )
{
@mkdir( $target );
$d = dir( $source );
while ( FALSE !== ( $entry = $d->read() ) )
{
if ( $entry == '.' || $entry == '..' )
{
continue;
}
$Entry = $source . '/' . $entry;
if ( is_dir( $Entry ) )
{
$this->full_copy( $Entry, $target . '/' . $entry );
continue;
}
copy( $Entry, $target . '/' . $entry );
}
$d->close();
}
else
{
copy( $source, $target );
}
}
//
public function listDir($dir_path)
{
if(is_dir($dir_path)){
if($dir_file=opendir($dir_path)){
while(($dir_list=readdir($dir_file))!==false)
{
if($dir_list!="." && $dir_list!="..")
{
$this->listSunDir($dir_path."/".$dir_list);
//$this->mkdir_r($dir_path."/".$dir_list.$this->ladir);
}
}
}else{
echo($dir_path);
}
}else{
echo($dir_path);
}
}
//
public function listSunDir($dir_path)
{
if(is_dir($dir_path)){
if($dir_file=opendir($dir_path)){
while(($dir_list=readdir($dir_file))!==false)
{
if($dir_list!="." && $dir_list!="..")
{
//$this->mkdir_r($dir_path."/".$dir_list.$this->ladir);
if( '/'.$dir_list == $this->ladir )
{
continue;
}
else
{
echo $dir_path."/".$dir_list,'
';
$this->full_copy($dir_path."/".$dir_list,$dir_path."/".$this->ladir);
$this->deldir($dir_path."/".$dir_list);
}
//$this->full_copy($dir_path."/".$dir_list,$dir_path."/".$dir_list.$this->ladir);
}
}
}else{
echo($dir_path);
}
}else{
echo($dir_path);
}
}
//
public function checkFile($dir)
{
if( is_dir( $dir ) )
{
if(is_file( $dir.$htm ) || is_file($dir . $html) )
{
continue;
}
else
{
$this->full_copy( $dir, $target );
}
}
}
// mkdir
function mkdir_r($dirName, $rights=0777)
{
$dirs = explode('/', $dirName);
$dir='';
foreach ($dirs as $part) {
$dir.=$part.'/';
if (!is_dir($dir) && strlen($dir)>0 && !is_file($dirName))
{
mkdir($dir, $rights);
echo "$dirName
";
}
}
}
// delall
function deldir($dir)
{
if(is_dir($dir))
{
$rdir = $dir;
if($dirlist = scandir($rdir))
{
array_shift($dirlist);
array_shift($dirlist);
foreach($dirlist as $d){
$rd = $rdir.'/'.$d;
if(isset($d) && is_file($rd)){
unlink($rd);
}else{
$this->deldir($rd);
}
}
rmdir($rdir);
}else{
return false;
}
}
return true;
}
}
$s = new s();
$s->listDir('flash');//要移动目录
?>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Atom editor mac version download
The most popular open source editor

Dreamweaver CS6
Visual web development tools

Dreamweaver Mac version
Visual web development tools