Advertisement
TheBiagio1996

Sposta file ricorsivo

Nov 17th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.42 KB | None | 0 0
  1.     function rcopy($src, $dst) {
  2.         if (file_exists ( $dst ))
  3.             rrmdir ( $dst );
  4.         if (is_dir ( $src )) {
  5.             mkdir ( $dst );
  6.             $files = scandir ( $src );
  7.             foreach ( $files as $file )
  8.                 if ($file != "." && $file != "..")
  9.                     rcopy ( "$src/$file", "$dst/$file" );
  10.         } else if (file_exists ( $src ))
  11.             copy ( $src, $dst );
  12.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement