Copying Directories

Copying Directories

Post by Nicholas P » Thu, 22 Jan 2004 00:42:22


John,

There is nothing in the framework to support this outright. You can
iterate through all the directories and sub directories in the directory,
and copy the items yourself.

Also, you might want to try the SHFileOperation API function. It will
allow you to copy a directory from one location to another. You will have
to call it through the P/Invoke layer.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- XXXX@XXXXX.COM

"John Bowman XXXX@XXXXX.COM >" <<Remove this before reply> wrote in

Directory
 
 
 

Copying Directories

Post by gabrie » Thu, 22 Jan 2004 01:01:18


This is off the top of my head, but it used to be that you could use the
Rename()-type functions to move directories... But it only worked if you
moved directories or files within the same drive.

Otherwise, just recreate the destination directory and loop to copy each
file.

--
gabriel