On my old VPS I was using the following code to copy the files and directories within a directory to a new directory that was created after the user submitted their form.
Could I suggest that (assuming it's a *nix VPS) that you just do a system call to cp -r and let that do the copy for you.
cp -r