Does anybody know how File.Delete and Directory.Delete execute?
I mean: what happens if assuming I were to delete some files/folders over the network and the network is considerably slow?
Would it complete as fast as it would be locally? Would it consume more bandwidth than say move files to that network location?
It won’t be as fast a it would be locally. It would be slow, with a latency that depends on your network conditions.
You don’t send your
Deletecommand “remotely” to a “smart end” which knows how to, say, delete a folder as an atomic operation. Your code actually runs against the network location which is “dumb” and deletes file-by-file.As for your last question,
Deleteis almost always faster thanMove. When you move files across disks (and of course across network locations), it’s actually a copy operation (with a ‘delete’ at the end of it).