How to move (or copy) a directory to a different drive

aewarnick

Well-known member
Joined
Jan 29, 2003
Messages
1,031
I did some testing in windows to see what windows does to move directories to another drive and within the same drive. It copies the directory to move it to another drive but just simply moves it when it is in the same drive.

My trouble is finding a method that will copy directory structures. The only ones I found are for single files. Either I have to make my own or someone here might know of one in the .net framework.

My program moves directories from one place to another. That is why I need it. If there is no method in the .net framework then would the best way to do this be to copy the dir to the clip board and then paste it to the other drive?
 
Im not fully sure if this is what you want. But System.IO.Directory.Move will move the whole directory with its structure.
 
It does not work when moving to another drive like from c:\ to d:\. I should have explained that a little better. That method just moves it. It does not copy it first and that seems to be what is needed for it to work.
 
Back
Top