日期:2014-05-18 浏览次数:20988 次
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Collections; namespace C_console { class Program { static void func(string str) { DirectoryInfo info = new DirectoryInfo(str); foreach( DirectoryInfo x in info.GetDirectories() ) { func( x.FullName ); } foreach (FileInfo i in info.GetFiles()) { list.Add(i.ToString()); } } static ArrayList list; static void Main(string[] args) { list = new ArrayList(); func( @"E:\mid" );//这里输入目录就好 foreach (string s in list) { Console.WriteLine(s); } } } }