Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

copy all folders from one directory to another php

function xcopy($src, $dest) {
    foreach (scandir($src) as $file) {
        if (!is_readable($src . '/' . $file)) continue;
        if (is_dir($src .'/' . $file) && ($file != '.') && ($file != '..') ) {
            mkdir($dest . '/' . $file);
            xcopy($src . '/' . $file, $dest . '/' . $file);
        } else {
            copy($src . '/' . $file, $dest . '/' . $file);
        }
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #copy #folders #directory #php
ADD COMMENT
Topic
Name
2+1 =