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.getdirector (); foreach (directoryInfo di in dis) {size = DIRSIZE (DI);} return (size);