K3

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

 static protected internal long CountFolderLength(string FolderPath)
        {
            long folder_length = 0;

            System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(FolderPath);
            System.IO.FileInfo[] fis = di.GetFiles();

            foreach (System.IO.FileInfo fi in fis)
                folder_length += fi.Length;

            System.IO.DirectoryInfo[] dis = di.GetDirectories();

            foreach (System.IO.DirectoryInfo cdi in dis)
            {
                folder_length += CountFolderLength(cdi.FullName);
            }

            return folder_length;
        }

posted on 2006-09-26 15:10  K3  阅读(310)  评论(0编辑  收藏  举报