Dear Community,
I use the following command to search all .xaml files in the directory including all subdirectories:
Directory.GetFiles(packageVersionPath,"*.xaml",searchOption.AllDirectories)
However, the code should avoid searching in the subdirectory called “Logs”. Or, alternatively, the code should skip all of the .xaml files that contain the word “MergedFile”. How can I implement either of these two exceptions?
Many thanks
G.
aksh1yadav
(AKSHAY YADAV)
December 6, 2018, 10:56am
2
Hey @Gennaro_Bozza
Try This:
Directory. GetFiles(“D:\Samplek”, “*.xaml”, SearchOption.AllDirectories).Where(function(s) NOT s.Contains(“MergedFile”))
use it in For each with type argument String.
Regards…!!
Aksh
3 Likes
SearchOption in GetFiles has only two values- TopDirectoryOnly and AllDirectories . So, no option here to exclude files.
But you can achieve this using LINQ query -
Directory.GetFiles(@"C:\Users\Karthik\Desktop\uipath\ReFrameWork-master\", "*.xaml", SearchOption.AllDirectories)
.Where(s => !(s.Contains("MergeData") || s.Contains("\\Log\\")))
1 Like
system
(system)
Closed
December 11, 2018, 3:37pm
4
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.