ulong TotalFiles(Collection <string> f) { ulong tt = 0; foreach (string fl in f) { ulong fsz = 0; try { SyncStat fi = src.GetInfo(fl); double sz = fi.Length * 1.0 / blocksize; fsz = (ulong)Math.Ceiling(sz); tt += fsz; } catch (Exception e) { WriteWarning(e.Message); WriteDebug(e.StackTrace); } if (all) { WriteResult(fsz, fl); // fileResults.Add(fl, fsz); } } return(tt); }
ulong ProcessDir(string p) { ulong dsize = 0; // check for symlink //Console.Write("{0} -> {1}\n",p,ss.Attributes); SyncStat ss = src.GetInfo(p); if ((ss.Attributes & System.IO.FileAttributes.ReparsePoint) == 0) { if ((ss.Attributes & System.IO.FileAttributes.Directory) != 0) { Collection <string> listDirectories = src.GetDirs(p); if (SeperateDir) { // don't add dirs foreach (string d in listDirectories) { try { ProcessDir(d); } catch (Exception e) { WriteWarning(e.Message); WriteDebug(e.StackTrace); } } } else { foreach (string d in listDirectories) { try { dsize += ProcessDir(d); } catch (Exception e) { WriteWarning(e.Message); WriteDebug(e.StackTrace); } } } Collection <string> listFiles = src.GetFiles(p); dsize += TotalFiles(listFiles); } else { double sz = ss.Length * 1.0 / blocksize; ulong fsz = (ulong)Math.Ceiling(sz); dsize += fsz; } if (!summarize) { // fileResults.Add(p, dsize); WriteResult(dsize, p); } } return(dsize); }