Created
March 9, 2018 00:05
-
-
Save JeremyKuhne/bc06fc15a2911796cc823150c257db29 to your computer and use it in GitHub Desktop.
Counting file bytes example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static long CountFileBytes(string directory, bool recursive) | |
{ | |
return (new FileSystemEnumerable<long>( | |
directory, | |
(ref FileSystemEntry entry) => entry.Length, | |
new EnumerationOptions() { RecurseSubdirectories = recursive }) | |
{ | |
ShouldIncludePredicate = (ref FileSystemEntry entry) => !entry.IsDirectory | |
}).Sum(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment