Advertisement
GigilinE

Untitled

Jul 20th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. <?php
  2. setlocale(LC_ALL,'en_US.UTF-8');
  3.  
  4. // cartella da copiare
  5. $src = 'F:\FOLDER\Pictures';
  6.  
  7. // destinazione
  8. $dest = 'F:\FOLDER\Personale';
  9.  
  10. // copia ricorsiva di tutto il contenuto della cartella sorgente
  11. recurse_copy($src,$dest);
  12.  
  13. function recurse_copy($src,$dst) {
  14. $dir = opendir($src);
  15. @mkdir($dst);
  16. while(false !== ( $file = readdir($dir)) ) {
  17.  
  18. $extension = pathinfo($file, PATHINFO_EXTENSION);
  19.  
  20. if (($extension != "PSD") and ($extension != "TIFF") and ($extension != "EPS") and ($extension != "DJVU") and ($extension != "CDP") and ($extension != "JPG") and ($extension != "PNG") and ($extension != "GIF") and ($extension != "JPEG") and ($extension != "BMP") and ($extension != "DROPBOX") and ($extension != "INI") and ($extension != "DNG") and ($extension != "NEF") and ($extension != "psd") and ($extension != "tiff") and ($extension != "eps") and ($extension != "djvu") and ($extension != "cdp") and ($extension != "jpg") and ($extension != "png") and ($extension != "gif") and ($extension != "jpeg") and ($extension != "bmp") and ($extension != "dropbox") and ($extension != "ini") and ($extension != "dng") and ($extension != "nef")) {
  21.  
  22. if (( $file != '.' ) && ( $file != '..' )) {
  23. if ( is_dir($src . '/' . $file) ) {
  24. recurse_copy($src . '/' . $file,$dst . '/' . $file);
  25. }
  26. else {
  27. rename($src . '/' . $file,$dst . '/' . $file);
  28. }
  29. }
  30. }
  31. }
  32. closedir($dir);
  33. }
  34.  
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement