Is there a way to exclude in Direcotry.GetFiles specific documents when they beginn with PL_ e.g. odr AUS_
I am having this code but it doesnt work very well I need the exlude the files to check when they start with PL_ or AUS_:
Try below expression.
Directory.GetFiles("C:\Users\msauro\Desktop\Tester\ToName","*.pdf",SearchOption.AllDirectories).Where(Function(x) Not x.StartsWith("PL") OR Not x.StartsWith("AUS")).ToArray
@david.mitrovic – Please try like below…
Directory.GetFiles("YourFolderPath",". pdf", SearchOption.AllDirectories).Where(Function(n) not path.GetFileName(n).Startswith("PL_") and path.GetFileName(n).Startswith("AUS_") and).ToArray
thanks for your alternative
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.