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.
On the “Indexing Options” window that opens, click the “Advanced” button. On the “Advanced Options” window, click the “File Types” tab. In the “File Types” tab, you see all the file formats that Windows currently displays in its search results. To exclude a file type from the index, deselect that type in the list.
For finding a specific file type, simply use the 'type:' command, followed by the file extension. For example, you can find . docx files by searching 'type: . docx'.
Excluded files in DeployHQ are files that you need to store in your repository, or that might be generated within a build pipeline but not upload to your server. This might be useful for certain files within your app that you want to version control but not actually deploy.
If you trust a file, file type, folder, or a process that Windows Security has detected as malicious, you can stop Windows Security from alerting you or blocking the program by adding the file to the exclusions list.
You should filter these files yourself, you can write something like this:
var files = Directory.GetFiles(jobDir).Where(name => !name.EndsWith(".xml"));
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