Skip to content

Instantly share code, notes, and snippets.

@daydaygo
Created January 4, 2018 06:15
Show Gist options
  • Save daydaygo/c48afbe440df79bd03aa9e3c293e29f1 to your computer and use it in GitHub Desktop.
Save daydaygo/c48afbe440df79bd03aa9e3c293e29f1 to your computer and use it in GitHub Desktop.
<?php
$dir = '';
foreach (scandir($dir) as $v) {
if ($v == '.' || $v == '..') {
continue;
}
if (is_dir($dir.'/'.$v)) {
foreach (scandir($dir.'/'.$v) as $vv) {
if ($v == '.' || $v == '..') {
continue;
}
if (is_file($dir.'/'.$v.'/'.$vv)) {
copy($dir.'/'.$v.'/'.$vv, $dir.'/'.$vv);
unlink($dir.'/'.$v.'/'.$vv);
}
}
rmdir($dir.'/'.$v);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment