I am trying to move a folder in php, but keep both files in the dest folder if there is a duplicate. I tried to do this in recursion, but too complicated, so many things can go wrong, such as with files and duplicate files / folders.
im trying to work with the system () command, and I cannot figure out how to move files, but keep a backup if duplicate without destroying the extension
$last_line = system('mv --backup=t websites/test/ websites/test2/', $retval);
gives the following if the file exists in both directories:
ajax.html~ ajax.html~1 ajax.html~2
Are looking for:
ajax~.html ajax~1.html ajax~2.html
or any others like (1), (2) ... but without destroying the file extension. any ideas? you are welcome.
ps should use the system () command.
source share