Reputation: 107
I am new to .NET and was exploring counting file size in a directory. I came across What is the fastest way to calculate a Windows folders size? which includes "Add a reference to the Microsoft Scripting Runtime and use:"
Scripting.FileSystemObject fso = new Scripting.FileSystemObject();
Scripting.Folder folder = fso.GetFolder([folder path]);
Int64 dirSize = (Int64)folder.Size;
I cant seem to find 'Microsoft Scripting Runtime' as a package or anything like that. The question, and answer, are very old so maybe none of this exists anymore?
Does anybody have any suggestions how to explore these lower level access methods? I have explored the .net Enumeration of Directories and then Files. Run time started at 11 seconds and after a bit of experimentation with Linq and aggregation in Linq its down to 2 seconds but it would be instructive to have an even better option (even if it would only be for windows)
Thanks JC
Upvotes: 0
Views: 85