Thank you so much, that update version works perfectly for me - I really do appreciate your help :)
-
Question - how in your code can I skip files/folders with certain attributes e.g. FileAttributes.ReparsePoint - as this is cause of C:\Users varying in size depending on method used? Thank you, once I can do this then it will do everything I need
I can confirm C:\users is now showing correct size as well, again after removing Windows Sandbox some files were removed from my user profile, so I suspect similar cause to above. So again I think solution here would be if someway to exclude a specific folder? or a specific file extension? Thanks
Okay having removed Windows Sandbox from Turn Windows Features On or Off and rebooted I can confirm that was certainly the cause of the miscalculation for the C:\ProgramData folder. It was finding .vhdx (Hard Disk Image Files) in C:\ProgramData\Microsoft\Windows\Containers and was looking in those virtual hard drive files and calculating the contents of all the files they contained as well, hence the result being incorrect and showing larger than the folder actually was. Is there a way to exclude...
C:\ProgramData\Microsoft\Windows\Containers\BaseImages is related to Windows 10 Sandbox - now removing that feature as that directory and the odd folders in it are certainly partly the cause. Will then work out what is causing similar issue of wrongly inflated size being reported for C:\users
Have fully compared output for C:\ProgramData and it is definitely nothing to do with hidden file as the files that FastFileInfo is finding and including are not hidden. Will continue to investigate
But somehow it is finding something wrongly because if I run it on every folder in my C:\ drive and then add up all the sizes for each folder it totals a larger size than my hard drive is! so physically impossible for the folder to be as big as it reports. Would really like to get this working as out of all the different methods I have tried (and I have tried a lot - https://social.msdn.microsoft.com/Forums/vstudio/en-US/91c76b90-805a-45d7-bd0b-ad032dd584fd/fastest-way-to-get-size-of-a-directory-including-all-files-and-sub-folders?forum=vbgeneral)...