1 //using System.IO;2 ///Directory: Manipulating folders/Directories class, Directory is static class3 ///Create a folder4Directory.CreateDirectory (@"d:\a"); 5 //Note: If the A folder is already in the D drive, it will not be re-created and will not overwrite6 7 //Delete a folder8 //FALSE: Only empty folders can be deleted, if not empty folders will be an error9Directory.delete (@"d:\a",false);Ten //ttrue: Delete folder, sub-directory, sub-file OneDirectory.delete (@"d:\a",true); A - //determine if the folder is empty - BOOLb = Directory.Exists (@"d:\a"); the - ///Cut Folder -Directory.move (@"d:\a",@"e:\b"); - + //get full path to all files under folder - string[] path = Directory.GetFiles (@"D:\"); + //get the folder under. JPG format Files APath = Directory.GetFiles (@"D:\",". jpg"); at //get the full path of the file plus all folders -Path = Directory.getdirectories (@"D:\");
C#_ Basic folder Operations category directory (17)