Hi here is my code,can someone help to edit the directory.getfile(),so i could output all files in c:\ Windows ?
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LogicalDrives
{
class Program
{
public static void GetLogicalDrives()
{
string[] drives = System.IO.Directory.GetLogicalDrives();
foreach (string str in drives)
{
System.Console.WriteLine(str);
}
}
public static void GetDirectories()
{
string[] dirs = System.IO.Directory.GetDirectories(@"c:\", "W*", System.IO.SearchOption.TopDirectoryOnly);
Console.WriteLine("The number of directories starting with W is {0}.", dirs.Length);
foreach (string dir in dirs)
{
System.Console.WriteLine(dir);
}
}
static void Main(string[] args)
{
GetLogicalDrives();
// Console.ReadKey();
GetDirectories();
Console.ReadKey();
}
}
}