My question is:
Do you want to process directories recursively (subdirectories, too) ?
OR
Do you want to process a distinct set of unrelated directories ?
If it is the former, the following function would be sufficient
instead of the verbose code you are using :
---
static List<FileInfo> Get(string dirPath)
{
DirectoryInfo dir = new DirectoryInfo(dirPath);
List<FileInfo> fileList = new List<FileInfo>();
// Html files (*.htm, *.html)
FileInfo[] files = dir.GetFiles("*.htm?",
SearchOption.AllDirectories);
fileList.AddRange(files);
// Text files (*.txt)
files = dir.GetFiles("*.txt", SearchOption.AllDirectories);
fileList.AddRange(files);
return fileList;
}
---
This List can then be bound directly to the GridView.
On Jul 29, 10:46 am, neema n <[email protected]> wrote:
> Dear friend
> here my code for listing aspx files from single directory.
> how can i list aspx files from multiple directory
>