看看这个函数.
private void ExplorerDirectory(DirectoryInfo dir)
{
FileInfo[] files=dir.GetFiles("*.rar");
foreach(FileInfo fi in files)
{
ListViewItem item=new ListViewItem(fi.Name.ToString());
item.SubItems.Add(fi.CreationTime.ToLongDateString());
item.SubItems.Add(fi.Extension.ToString());
listView1.Items.Add(item);
}
DirectoryInfo[] directores=dir.GetDirectories();
foreach(DirectoryInfo newdir in directores)
{
ExplorerDirectory(newdir);
}
}