For example. I have folder “MyFolder”
And I want to get the size of all files that file name is “*D.*“
Is there a easy way to do this?
(P.S. I know for whole folder, I can use TotalSize() to get its size, but how about with my constraints?)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, there is. A single line of code actually:
And if you are targeting a .NET version prior to .NET 4.0 where the EnumerateFiles method is not available you could use the GetFiles method instead.