On Thursday, 7 December 2017 at 09:04:19 UTC, Vino wrote:
On Wednesday, 6 December 2017 at 15:04:55 UTC, Andrea Fontana
wrote:
On Wednesday, 6 December 2017 at 14:49:48 UTC, Vino wrote:
[...]
Just use Array! constructor.
auto mSize () {
string FFs = "/home/andrea/Scaricati";
return
Array!(Tuple!(string,string))(
dirEntries(FFs, SpanMode.shallow)
.filter!(a => a.isDir)
.map!(a => tuple(a.name,
a.dirEntries(SpanMode.depth).filter!(a=>a.isFile).map!(a =>
a.size).sum))
.filter!(a => a[1] > 1024*1024*30)
.map!(a => tuple(a[0], a[1].to!string))
);
}
Hi Andrea,
I test your code, initially it error ed out stating "patch
does not exist", the reason for this error is that the length
of the path is more than 256 , so added the UNC path to the
code as below.
auto mSize () {
string FFs = "C:\Temp\BACKUP";
ulong SGb = 1024 * 1024;
int SizeDir = 10;
return Array!(Tuple!(string,real))(
dirEntries(join(["\\\\?\\", FFs]), SpanMode.shallow).filter!(a
=> a.isDir)
.map!(a => tuple(a.name,
a.dirEntries(SpanMode.depth).filter!(a=>a.isFile)
.map!(a => a.size).sum)).filter!(a => a[1] > (SGb * SizeDir))
.map!(a => tuple(a[0], ((a[1].to!real)/ SGb ))));
}
The output of the code is as below
\\?\C:\Temp\BACKUP\dir1 34.90
\\?\C:\Temp\BACKUP\dir2 36.18
So how do we print the output without UNC path
C:\Temp\BACKUP\dir1 34.90
C:\Temp\BACKUP\dir2 36.18
From,
Vino.B
Hi Andrea,
Was able to find a solution to the above issue by adding the
replace function as below, the the code is working as expected,
is there any chance of using parallel function as the file system
contains about 500+ folders and the size of each folder ranges
from 5GB - 500 GB so the run time of the above code is about an 2
hours.
.map!(a => tuple(a[0].replace(",\\?\", ""), ((a[1].to!real)/ SGb
))));
From,
Vino.B