I Cannot find a copy fiolder method in System.IO

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to copy (not move) a directory and all of its contents to another Location Disk / Server / Universe etc.

But I cannot find a Copy method on the Directory or DirectoryInfo objects only a move.
There is a copy on the FileInfo.
I would have to write a recursive procedure to loop through the source directory creating destination directories and copying files to them.
I am quite capable of writing such a procedure, but I don't think that I should have to. I also do not want to use the Scripting.FileSystemObject which will do this very easily.

Any thoughts please

Ben
 
Hi Ben,

It is funny, this question comes regulary, however not often and at almost
the same time it was from someone else in the newsgroup.
microsoft.public.dotnet.vb.

I've never seen an answer on this question. In the vb.language group OHM
gave the answer to use a commandline copy for this. (I think xcopy)

I hope it helps anyhow?

Cor
 
I am not suprised that the question is often Asked - If the Search facility worked on this newsgroup, I might have been able to find some past instances of it. :*)

Is it possible that this functionality has simply been overlooked by the .net framework developers?
 
You might try looking at the DirectoryInfo and Directory classes. I believe they can can copy directories and/or move directories.
 
Dennis - I refer you to my original post

"But I cannot find a Copy method on the Directory or DirectoryInfo objects only a move."

Ben
 
Back
Top