C# 遍历文件夹

    DirectoryInfo dir = new DirectoryInfo(dicPath);


            foreach (FileInfo f in dir.GetFiles("*.txt"))
            {

                String name = f.Name;
                long size = f.Length;
                 DateTime creationTime = f.CreationTime;
                Console.WriteLine("{0,-12:N0} {1,-20:g} {2}", size,
                    creationTime, name);
            }


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