Pasting of folders in same dir adds (num)

If the dir exists, run thru from 2 to 1billion looking for next
available number and set the $dest name as that. All exactly the same as
how it works for pasting files.
This commit is contained in:
Matt Pass
2013-03-02 21:59:01 +00:00
parent b0f0bb10ec
commit 8750fe7a43

View File

@@ -68,6 +68,14 @@ if ($_GET['action']=="paste") {
if (is_dir($source)) {
if (!is_dir($dest)) {
mkdir($dest, 0705);
} else {
for ($i=2; $i<1000000000; $i++) {
if (!is_dir($dest." (".$i.")")) {
$dest = $dest." (".$i.")";
mkdir($dest, 0705);
$i=1000000000;
}
}
}
foreach ($iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS),