//累加当前目录下的子目录大小-C#入门经典ppt

时间:2024-05-16 03:22:58
【文件属性】:

文件名称://累加当前目录下的子目录大小-C#入门经典ppt

文件大小:4.81MB

文件格式:PPT

更新时间:2024-05-16 03:22:58

C#,入门经典

//累加当前目录下的子目录大小 DirectoryInfo[] dis = d.GetDirectories(); foreach (DirectoryInfo di in dis) { Size += DirSize(di); } return (Size); } public static void Main(string[] args) { if (args.Length != 1) { Console.WriteLine("You must provide a directory argument at the command line."); } else { DirectoryInfo d = new DirectoryInfo(args[0]); Console.WriteLine("The size of \n{0} and its subdirectories \nis {1} bytes.", d, DirSize(d)); } } }


网友评论