-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Description
Summary of the new feature / enhancement
I am writing a script that automatically runs some backups in PowerShell 7. And for that I have to know the sizes of the things I want to back up. But I noticed that Get-ChildItem only returns the actual file size and has no way to get the size on the disk that respects the cluster overhead the files can take up, which leads to file size calculations I make to often be smaller than the size on the disk which could prove problematic when evaluating wether another disk I want to copy to or not has enough free space. This is especially true if there are a lot of small files. So as of right now I have to complicatedly load in C# code to make windows API calls to get the cluster size and then make calculatons with that cluster size.
And using fsutil is not really a good option because in my case it seems to require elevated permissions.
Proposed technical implementation details (optional)
Maybe either add a parameter to Get-ChildItem that does this api calling logic itself or add a command that you can pipe results through that gets actual size on disk.