我想使一些代碼來計算目錄及其子目錄中的所有文本文件。我曾嘗試下面的代碼:遞歸地查找目錄中的文本文件的計數
private void button1_Click_1(object sender, EventArgs e)
{
FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog();
DialogResult result = folderBrowserDialog1.ShowDialog();
if (result == DialogResult.OK)
{
string[] files = Directory.GetFiles(folderBrowserDialog1.SelectedPath);
MessageBox.Show("Files found: " + files.Length.ToString(), "Message");
}
}
http://stackoverflow.com/a/27584/181771 – DaveDev
什麼問題? –