August 25, 2017 Re: Long File path Exception:The system cannot find the path specified | ||||
---|---|---|---|---|
| ||||
Posted in reply to vino | On Thursday, 24 August 2017 at 18:02:24 UTC, vino wrote:
> Thanks for your support, was able to resolve this issue.
Hello.
IMHO, it will be better, if you will share your solution for other peoples :)
|
August 25, 2017 Re: Long File path Exception:The system cannot find the path specified | ||||
---|---|---|---|---|
| ||||
Posted in reply to zabruk70 | On Friday, 25 August 2017 at 09:08:44 UTC, zabruk70 wrote: > On Thursday, 24 August 2017 at 18:02:24 UTC, vino wrote: >> Thanks for your support, was able to resolve this issue. > > Hello. > IMHO, it will be better, if you will share your solution for other peoples :) Hi, Please find the solution below, basically i converted the path to UNC path as below Solution: auto unc = "\\\\?\\"~i; auto dFiles = dirEntries(unc, SpanMode.shallow).filter!(a => a.isDir && !globMatch(a.baseName, "*DND*")).array; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Program: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX import std.file: dirEntries, isFile, SpanMode, remove, rmdirRecurse, exists, mkdir; import std.stdio: writeln, writefln, File; import std.algorithm: filter; import std.array: array; import std.path: globMatch, baseName; /**********************************************/ /* Global Valiables */ /**********************************************/ int SizeDir = 10; /**********************************************/ /* Folder Lists */ /**********************************************/ auto SizeDirlst = [ "N:\\PROD_TEAM", "P:\\TEAM" ]; /******************************************/ /* Function : Size of Non DND Dir List */ /******************************************/ void SizeDirList (string[] SzDNDlst) { ulong subdirTotal = 0; foreach (string i; SzDNDlst[0 .. $]) { auto unc = "\\\\?\\"~i; auto dFiles = dirEntries(unc, SpanMode.shallow).filter!(a => a.isDir && !globMatch(a.baseName, "*DND*")).array; foreach (d; dFiles) { auto SdFiles = dirEntries(d, SpanMode.breadth).array; foreach (f; SdFiles) { subdirTotal += f.size; } ulong subdirTotalGB = (subdirTotal/1024/1024/1024); if (subdirTotalGB > SizeDir) { writefln("%-63s %s", d[0].replace("\\\\?\\", ""), subdirTotalGB); } subdirTotal = 0; } } } /********************************************************************************************/ /* Main */ /********************************************************************************************/ void main () { SizeDirList(SizeDirlst); } |
Copyright © 1999-2021 by the D Language Foundation