and doCopyFile() at the bottom.

One reason is that sometimes remote files get spotted as local ones, and mapped so they go direct.