The List of Files in the Directory are : C:\sri\message.txt C:\sri\srip.txt C:\sri\test.txt
Users Online
· Guests Online: 101
· Members Online: 0
· Total Members: 188
· Newest Member: meenachowdary055
· Members Online: 0
· Total Members: 188
· Newest Member: meenachowdary055
Forum Threads
Newest Threads
No Threads created
Hottest Threads
No Threads created
Latest Articles
Articles Hierarchy
C# Program to Search Directories and List Files
C# Program to Search Directories and List Files
This is a C# Program to search directories and list files.
Problem Description
This C# Program Searches Directories and List Files.
Problem Solution
Here the particular given directory is searched and all the files are listed.
Program/Source Code
Here is source code of the C# Program to Search Directories and List Files. The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.
/* * C# Program to Search Directories and List Files */ using System; using System.IO; class Program { static void Main() { string[] Dirfile = Directory.GetFiles("C:\\sri\\","*.*", SearchOption.AllDirectories); foreach (string file in Dirfile) { Console.WriteLine(file); } Console.Read(); } }
Program Explanation
This C# program is used to search directories and list files. Here the particular given directory is searched and all the files are listed. Using foreach loop print the directories and list files.
Runtime Test Cases
Comments
No Comments have been Posted.
Post Comment
Please Login to Post a Comment.