文件夹操作

string foldername = ".""";
            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                foldername = folderBrowserDialog1.SelectedPath;
            }

            if (System.IO.Directory.Exists(foldername))
            {
                System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(foldername);
                System.IO.FileInfo[] fi = di.GetFiles("*.wmf");
                if (fi.Length != 0)
                {
                    foreach (FileInfo f in fi)
                    {
                        MessageBox.Show(f.ToString());
                    }
                }
            }
posted on 2009-05-24 17:40  lgfcs  阅读(79)  评论(0)    收藏  举报