I'm developing a system in PHP + AJAX that could copy files from one folder on the server to another folder in the server.
My question is when I try to copy a folder to another one that already have some files with the same name inside of it.
In this case, I want to show a popup to the user in order to confirm if he wants to overwrite EACH one of this files.
How could I do that? How can I wait for the response of the user to each dialog after starting the copy?
By the way, is it better to use the cp
command of linux or is it better to do this using unlink
and rmdir
of PHP?
I think you should divide the process into several parts:
If you want to ask for each one of this files, ask a confirmation per file (a dialog box with checkboxes, or several dialog boxes). Once the user has confirm (or not) every overwriting, copy the files.