C# .NET - retrive folders name - Asked By hiren dhameliya on 21-Mar-12 06:39 AM

Hi,


i want to retrive folders name from one directoriy .....how i retrive all folder name for one  perticular folder ......
and files as well
#reply  me  as  soon as possbile..

thanks...
D Company replied to hiren dhameliya on 21-Mar-12 07:47 AM
Hello,

U can use getfilename method to fetch the folder name , like this

string folderName = Path.GetFileName( Path.GetDirectoryName( "Here your path ") ); if u want to fetch all file in specific drive then do like this

string[] filearray= Directory.GetFiles(@"Your Drive ", "*.BIN");

follow this MSDN article for more detail
http://msdn.microsoft.com/en-us/library/6yk7a1b0.aspx


Regards
D