Here's how to use DirectoryInfo to enumerate files and subdirectories:
using System;
using System.IO;
using System.Linq;
using System.Text;
class Program
{
static void Main()
{
DirectoryInfo di = new DirectoryInfo(@"c:\photos");
foreach (FileInfo fi in di.GetFiles("*.jpg"))
Console.WriteLine(fi.Name);
foreach (DirectoryInfo subDir in di.GetDirectories())
Console.WriteLine(subDir.FullName);
}
}
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |