Re: Copying Directories System.IO.Directory class by Metallikanz!
Metallikanz!
Tue Aug 16 12:48:06 CDT 2005
This is a multi-part message in MIME format.
------=_NextPart_000_007F_01C5A2B8.C1F358C0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: quoted-printable
I don't think we have this functionality in the FCL off the shelf =
however, you could write a very simple recursive method which does it or =
better still, if ur one of my types......
System.Diagnostics.Process oProcess =3D new =
System.Diagnostics.Process();
oProcess.StartInfo.FileName =3D "xcopy";
oProcess.StartInfo.Arguments =3D String.Format(@" ""{0}"" ""{1}"" /S /E =
/Y", source,
destination);
oProcess.Start();
.... use the good old XCopy and get the job done with minimum fuss.
HTH, Metallikanz!
"paul" <paul@discussions.microsoft.com> wrote in message =
news:84C682AA-BA7E-44ED-B433-25FAC4DF5A14@microsoft.com...
> Is there a way to copy directory contents using the =
System.IO.Directory class?
> I want to make a full copy of one folder (files and subfolders) to =
another=20
> folder.
> I'm able to move the folder using Directory.Move but that removes the =
files=20
> from the source folder. I see File.Copy but that only copies an =
individual=20
> file.
> I don't see Directory.Copy so I'm not sure if this is easily =
accomplished.
>=20
> Thanks
------=_NextPart_000_007F_01C5A2B8.C1F358C0
Content-Type: text/html;
charset="Utf-8"
Content-Transfer-Encoding: quoted-printable
=EF=BB=BF<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dutf-8">
<META content=3D"MSHTML 6.00.2900.2722" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DVerdana color=3D#0000ff size=3D2></FONT><FONT =
face=3DVerdana=20
color=3D#0000ff size=3D2>I don't think we have this functionality in the =
FCL off the=20
shelf however, you could write a very simple recursive method which =
does it=20
or better still, if ur one of my types......</FONT></DIV>
<DIV><FONT face=3DVerdana color=3D#0000ff size=3D2></FONT> </DIV>
<DIV><FONT face=3DVerdana color=3D#0000ff =
size=3D2>System.Diagnostics.Process oProcess=20
=3D new System.Diagnostics.Process();<BR>oProcess.StartInfo.FileName =3D =
"xcopy";<BR>oProcess.StartInfo.Arguments =3D String.Format(@" ""{0}"" =
""{1}"" /S=20
/E /Y", source,<BR>destination);<BR>oProcess.Start();</FONT></DIV>
<DIV><FONT face=3DVerdana color=3D#0000ff size=3D2></FONT> </DIV>
<DIV><FONT face=3DVerdana color=3D#0000ff size=3D2>.... use the good old =
XCopy and get=20
the job done with minimum fuss.</FONT></DIV>
<DIV><FONT face=3DVerdana color=3D#0000ff size=3D2></FONT> </DIV>
<DIV><FONT face=3DVerdana color=3D#0000ff size=3D2>HTH, =
Metallikanz!</FONT></DIV>
<DIV><FONT face=3DVerdana color=3D#0000ff size=3D2></FONT> </DIV>
<DIV><FONT face=3DVerdana color=3D#0000ff size=3D2>"paul" <</FONT><A=20
href=3D"mailto:paul@discussions.microsoft.com"><FONT face=3DVerdana=20
size=3D2>paul@discussions.microsoft.com</FONT></A><FONT face=3DVerdana =
color=3D#0000ff=20
size=3D2>> wrote in message </FONT><A=20
href=3D"news:84C682AA-BA7E-44ED-B433-25FAC4DF5A14@microsoft.com"><FONT=20
face=3DVerdana=20
size=3D2>news:84C682AA-BA7E-44ED-B433-25FAC4DF5A14@microsoft.com</FONT></=
A><FONT=20
face=3DVerdana color=3D#0000ff size=3D2>...</FONT></DIV><FONT =
face=3DVerdana=20
color=3D#0000ff size=3D2>> Is there a way to copy directory contents =
using the=20
System.IO.Directory class?<BR>> I want to make a full copy of one =
folder=20
(files and subfolders) to another <BR>> folder.<BR>> I'm able to =
move the=20
folder using Directory.Move but that removes the files <BR>> from the =
source=20
folder. I see File.Copy but that only copies an individual =
<BR>>=20
file.<BR>> I don't see Directory.Copy so I'm not sure if this is =
easily=20
accomplished.<BR>> <BR>> Thanks</FONT></BODY></HTML>
------=_NextPart_000_007F_01C5A2B8.C1F358C0--