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)