Skip to content

How to get size of a directory? #3390

Answered by augustoproiete
ArtjomP asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @ArtjomP, there's no equivalent alias for Directories, but you could easily use GetFiles to enumerate all the files in a directory and sum up the file sizes.

e.g.

var fileSizes = GetFiles("./**/*.*").Sum(FileSize);
Information("File sizes: {0}", fileSizes);

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ArtjomP
Comment options

Answer selected by ArtjomP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants