综合

img littlehb

得到目录大小

发表于2004/10/25 14:01:00  726人阅读

public static long DirSize(DirectoryInfo d)
    {   
        long Size = 0;   
        // Add file sizes.
        FileInfo[] fis = d.GetFiles();
        foreach (FileInfo fi in fis)
        {     
            Size += fi.Length;   
        }
        // Add subdirectory sizes.
        DirectoryInfo[] dis = d.GetDirectories();
        foreach (DirectoryInfo di in dis)
        {
            Size += DirSize(di);  
        }
        return(Size); 
    }

 

阅读全文
0 0

相关文章推荐

img
取 消
img