How can I make GetFiles() exclude files with extensions that start with the search extension?

.net, c#, file-extension, filepattern, getfiles

Solution

Try this, filtered using file extension.

  FileInfo[] files = nodeDirInfo.GetFiles("*", SearchOption.TopDirectoryOnly).
            Where(f=>f.Extension==".sbs").ToArray<FileInfo>();

Problem

I am using the following line to return specific files... ``` FileInfo file in nodeDirInfo.GetFiles("*.sbs", option) ``` But there are other files in the directory with the extension `.sbsar`, and it is getting them, too. How can I differentiate between `.sbs` and `.sbsar` in the search pattern?

Original source