Folder and File traversing in C#
-
i am doing a windows desktop application in C#. In this project when I select a folder i want to traverse through its subfolders and files to the leaf level. How can i do this in C#. I am selecting folder using FolderBrowserDialog. I am stuck after that.. how can i gets its fils and subfolders. I VB 6.0 and all we have files sytem and folder objects to travese. Here what we have to do? :( hope i will get a reply soon ...thanks ...hari
-
i am doing a windows desktop application in C#. In this project when I select a folder i want to traverse through its subfolders and files to the leaf level. How can i do this in C#. I am selecting folder using FolderBrowserDialog. I am stuck after that.. how can i gets its fils and subfolders. I VB 6.0 and all we have files sytem and folder objects to travese. Here what we have to do? :( hope i will get a reply soon ...thanks ...hari
Use the DirectoryInfo class. DirectoryInfo di = new DirectoryInfo(path); FileSystemInfo[] fi = di.GetFileSystemInfos(); fi contains a list of all the folders and files in the directory represented by path. Now you can traverse through that list. Consult MSDN on DirectoryInfo class for further details
------------- The primary aim of AI is to make programming languages understand how frustrating it is to program them
-
i am doing a windows desktop application in C#. In this project when I select a folder i want to traverse through its subfolders and files to the leaf level. How can i do this in C#. I am selecting folder using FolderBrowserDialog. I am stuck after that.. how can i gets its fils and subfolders. I VB 6.0 and all we have files sytem and folder objects to travese. Here what we have to do? :( hope i will get a reply soon ...thanks ...hari
The
FolderBrowserDialog.SelectedPath
property contains the Path selected by the user. Everything else you need can be found in theSystem.IO
namespace in particularDirectory
,DirectoryInfo
,File
andFileInfo
classes.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
-
The
FolderBrowserDialog.SelectedPath
property contains the Path selected by the user. Everything else you need can be found in theSystem.IO
namespace in particularDirectory
,DirectoryInfo
,File
andFileInfo
classes.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook