. NET Learning notes----2015-07-02 (Directory Class)

Source: Internet
Author: User

1. Directory Operations folder

Creatdirectory Creating a Folder

Delet Deleting a folder

Move Cut Folder

Exist judge whether there is

GetFiles gets the full path of all files under the specified directory

Getdirectory get full path to all folders under the specified directory

            //File Path FileStream StreamReader StreamWriter//Directory Operations folder, directory class//Create a folder//directory.createdirectory (@ "E:\csharp\a"); //Console.WriteLine ("Created successfully"); //Console.readkey (); //Delete a folder//Directory.delete (@ "E:\csharp\a", true); //Console.WriteLine ("Delete succeeded"); //Console.readkey (); //Cut//Directory.move (@ "E:\csharp\a", @ "E:\new"); //Console.WriteLine ("Shear Success"); //Console.readkey (); //get the full path to all files under the specified folder, "*.jpg" can extract only. jpg files//string[] Path = Directory.GetFiles (@ "C:\Users\Administrator\Desktop\picture", "*.jpg"); //for (int i = 0; i < path. Length; i++)//{            //Console.WriteLine (Path[i]); //}            //Console.readkey (); //gets the full path of all folders under the specified path//string[] Path = directory.getdirectories (@ "D:\Csharp tutorial"); //for (int i = 0; i < path. Length; i++)//{            //Console.WriteLine (Path[i]); //}            //Console.readkey (); //determine if the specified folder exists//if (directory.exists (@ "E:\csharp\a\b"))//{            //for (int i = 0; i <; i++)//    {            //directory.createdirectory (@ "E:\csharp\a\b\" + i); //    }            //}            //Console.WriteLine ("OK"); //Console.readkey ();Directory.delete (@"E:\csharp\a\b",true);

. NET Learning notes----2015-07-02 (Directory Class)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.