Your problems are probably due to file permissions or something else having a lock on the file.
If you can't copy over it, then you could check for locks, sleep, and retry for a while. If you don't know or have control over the files that you're copying over, you may want to check permissions on the files first and process accordingly.