Is there a way to get a file count in a folder, but I want to exclude files with extension jpg?
Directory.GetFiles("c:\\Temp\\").Count();
Try this:
var count = System.IO.Directory.GetFiles(@"c:\\Temp\\")
.Count(p => Path.GetExtension(p) != ".jpg");
Good luck!
You can use a DirectoryInfo
object on the directory, and do a GetFiles()
on it with a filter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With