Cannot reduce an empty iterable w/o an explicit seed value
Vino
vino.bheeman at hotmail.com
Thu Nov 9 12:40:49 UTC 2017
Hi All,
Request your help, when i execute the below line of code i am
getting an error message as "Cannot reduce an empty iterable w/o
an explicit seed value" , The below lie of code will iterate
several file system and will report the size of the folder (level
1) which is greater than 10GB.
Program:
auto coSizeDirList (string FFs, int SizeDir) {
float subdirTotal;
float subdirTotalGB;
Array!string Result;
auto dFiles = Array!string ((dirEntries(FFs,
SpanMode.shallow).filter!(a => a.isDir))[].map!(a => a.name));
foreach (d; parallel(dFiles[], 1)) {
auto SdFiles = Array!float ((dirEntries(join(["\\\\?\\", d]),
SpanMode.depth).filter!(a => a.isFile))[].map!(a =>
to!float(a.size)));
{
subdirTotalGB = ((reduce!((a,b) => a + b)(SdFiles)) / 1024 /
1024 / 1024);
}
if (subdirTotalGB > SizeDir) {
Result.insertBack(d); Result.insertBack(to!string(subdirTotalGB));
}
}
return Result;
}
From,
Vino.B
More information about the Digitalmars-d-learn
mailing list