Php
function Copy_module_file ($path, $NEWP) {if (!is_dir ($NEWP)) {mkdir ($NEWP);} if (file_exists ($path)) {if (Is_file ($path)) {copy ($path, $NEWP),} else{$handle = Opendir ($path), while ($file = Readdir ( $handle))! = ') {if ($file! = ".") && ($file! = "...") && ($file! = "")) {if (Is_dir ("$path/$file")) {Copy_module_file ("$path/$file", "$NEWP/$file");} else{copy ("$ path/$file "," $NEWP/$file ");}}} Closedir ($handle);}}
This PHP code is in my program, a copy of the directory under the Thousand folder into another folder, there are many directories, such as the folder contains 1-100 directory names are 1-100, I just want to copy: 1,2,3,4 These directories other do not copy, this PHP need to change a bit, I am a novice, hope to get expert guidance!
Reply to discussion (solution)
if (Is_dir ("$path/$file")) {
Switch
if (Is_dir ("$path/$file") && In_array ($file, Array (' 1 ', ' 2 ', ' 3 ', ' 4 '))) {
Again, if you do not want to copy the root directory, test.txt files only copy the 1,2,3,4 directory, how should you change it??