Exclude certain file extensions when getting files from a directory

c#, directory, file

Solution

You should filter these files yourself, you can write something like this:

    var files = Directory.GetFiles(jobDir).Where(name => !name.EndsWith(".xml"));

Problem

How to exclude certain file type when getting files from a directory? I tried ``` var files = Directory.GetFiles(jobDir); ``` But it seems that this function can only choose the file types you want to include, not exclude.

Original source

Related problems