遍历文件夹

            DirectoryInfo TheFolder=new DirectoryInfo("c:\\");
            foreach(DirectoryInfo NextFolder in TheFolder.GetDirectories())
            this.listBox1.Items.Add(NextFolder.Name);
            foreach(FileInfo NextFile in TheFolder.GetFiles())
            this.listBox2.Items.Add(NextFile.Name);

你可能感兴趣的:(遍历文件夹)