18.2 Copying, moving, and deleting directories


For deleting and moving a directory and its contents, both Directory and DirectoryInfo contain the following methods shown in Table 18.4.

Table 18.4. Methods to use for performing common directory operations

Function

System.IO.DirectoryInfo

System.IO.Directory

Copying a directory

No method

No method

Moving a directory

MoveTo (string destination_path)

Move (string source_path, string destination_path)

Deleting a directory

Delete ()

Delete (string path )

Note that there is no method for copying a whole directory and its contents. You will have to perform manual copying of each file within.



From Java to C#. A Developers Guide
From Java to C#: A Developers Guide
ISBN: 0321136225
EAN: 2147483647
Year: 2003
Pages: 221
Authors: Heng Ngee Mok

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net