using System.IO;
namespace 获取文件夹和文件路径
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] filePath = Directory.GetFiles(@"D:\123");//文件路径
            string[] dirPath =Directory.GetDirectories(@"D:\123");//文件夹路径
            foreach (string fies in filePath)
            {
                Console.WriteLine(fies);
            }
            foreach (string dir in dirPath)
            {
                Console.WriteLine(dir);
            }
            Console.ReadKey();
        }
    }
}

 

posted on 2022-06-01 20:35  sbwynnss  阅读(305)  评论(0)    收藏  举报