Lynx
(Lnx)
1
Good morning friends:
I have a question please:
I want to create an array but filter the names of the files, I was using one:
Before I had the following:
Activity Assessing
nameArray= Directory.GetFiles(Downloadfolder,“AKP”)
Now I would like the opposite, that is to say that it only filters those that are not “AKP”
Example files:
MPT_color.xlsx
AKP_glass.xlsx
ART_home.xlsx
NUY_desk.xlsx
OPK_pen.xlsx
AKP_music.xlsx
The array should contain the following:
MPT_color.xlsx
ART_home.xlsx
NUY_desk.xlsx
OPK_pen.xlsx
Hi @Lynx ,
We can only use literals (* ?) in the Search Pattern, so there isn’t much we can do with that Function alone.
It has to be supplemented with a method or two like so:
Directory.GetFiles(Downloadfolder,"*.xlsx").Where(Function(w) Not (Path.GetFileNameWithoutExtension(w).ToLower.Contains("akp"))).ToArray()
Could you give that a try and let us know if it works?
Kind Regards,
Ashwin A.K
1 Like
ppr
(Peter Preuss)
3
we have several options for this type of inclusion / exclusion like LINQ, Regex, Set Operations
1 Like
Lynx
(Lnx)
4
Thank you very much @ashwin.ashok 
1 Like
system
(system)
Closed
5
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.