I am in the process of migrating legacy data to a new system. I need to copy something in the area of 10000 files from one directory structure to another. Both the old and new directory structure are on the same file server, somewhere in a data-center in another country. I have to run the application that takes care of copying the files locally (not on the remote file server).
My current implementation reads one file at a time into a memory-stream. Then writes the memory stream to a newly created file in the other location. This works fine, however it is obvious that I transfer every file from the file server to my local machine and then back to the file server.
I would like to know if it would make a difference if I used File.Copy(src, trg) instead. Would Windows be clever enough to handle the process of copying the files remotely (on the file server) without sending a single byte of filedata over the wire in the process?
If this cannot be done using File.Copy(…) is there another way of reaching my goal of handling the file-copy operation entirely remotely?
Short answer: No, it wouldn’t.
Can you log into the remote server? Then you could start the job there…