Unlimited level directory copy

xiaoxiao2021-03-06  51

Unlimited class catalog copy,

// This program is originally created by WM_CHIEF, if you want to reprint, please indicate your author and source (http://www.phome.net)

$ O_PATH = "admin"; // Source Directory

$ n_path = "n_admin"; // New directory

Class Copy_Path

{

Function WM_CHIEF_COPYPATH ($ O_PATH, $ N_PATH)

{$ HAND = Opendir ($ O_PATH);

If (! file_exists ($ n_path)) // The target directory does not exist

{$ this-> wm_chief_createpath ($ n_path);

$ I = 0;

While ($ file = readdir ($ HAND))

{$ i ;

IF ($ i == 1 || $ i == 2)

{Continue;

IF (! ($ file, ")))))))

{

$ O_S_PATH = $ O_PATH. "/". $ FILE;

$ n_s_path = $ n_path. "/". $ file;

$ this-> wm_chief_copypath ($ O_S_PATH, $ N_S_PATH);

}

Else

{

$ O_FILE = $ O_PATH. "/". $ file;

$ n_file = $ n_path. "/". $ file;

$ this-> wm_chief_copyfile ($ O_FILE, $ N_FILE);

}

}

CloseDir ($ HAND);

Return True;

}

Function WM_CHIEF_COPYFILE ($ O_FILE, $ N_FILE)

{

Copy ($ O_FILE, $ N_FILE);

}

Function WM_CHIEF_CREATEPATH ($ n_path)

{

MKDir ($ n_path, 0777);

}

}

$ WM_CHIEF = New Copy_path ();

$ WM_CHIEF_OK = $ WM_CHIEF-> WM_CHIEF_COPYPATH ($ O_PATH, $ N_PATH);

IF ($ WM_CHIEF_OK)

{

ECHO "Copy is complete";

}

// This program is originally created by WM_CHIEF, if you want to reprint, please indicate your author and source (http://www.phome.net)

?>

转载请注明原文地址:https://www.9cbs.com/read-71447.html

New Post(0)