I have a command as below. I find if I use a file pattern of *.csv
it also picks up items with a .csvx
extension. Maybe it's a throwback to the 8.3 filename days - anyone know a way that would return them properly, preferably without rolling our own?
files = (from file in Directory.EnumerateFiles(sourceFolder, filePattern, SearchOption.TopDirectoryOnly) select file).ToList();
Just a workaround but might be good enough:
var files = Directory
.EnumerateFiles(sourceFolder, filePattern, SearchOption.TopDirectoryOnly)
.Where(f => f.EndsWith(".csv"))
.ToList();
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