From 8750fe7a4314ef28c56c6e52583cd143322e9552 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Sat, 2 Mar 2013 21:59:01 +0000 Subject: [PATCH] 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. --- lib/file-control.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/file-control.php b/lib/file-control.php index a93d633..7ef8d68 100644 --- a/lib/file-control.php +++ b/lib/file-control.php @@ -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),