Hello All,
I need to fetch specific files from a folder by filtering the name.
I need to fetch txt files named Auth_released_20220303.txt,Auth_released_20220304.txt,Auth_released_20220305.txt from a folder. However there are a lot of txt files as well with other names.
How Can I get all the required files?
Any leads or helps are much appreciated.
Gokul001
(Gokul Balaji)
March 15, 2022, 1:27pm
2
Hi @Sirimalla_Karthik_Chandra
Have look on the document
Hi Guys, sorry to interrupt. I am new to UiPath and a intern at a local company. Just want to ask you guys how to filter or get the specific file like Lido, Nex, etc after I have downloaded from email?
[Problem]
[Problem2]
Regards
Gokul
Gokul001
(Gokul Balaji)
March 15, 2022, 1:37pm
3
Hi @Sirimalla_Karthik_Chandra
Have a look on the XAML file
SpecificFileinFolder.xaml (7.9 KB)
Regards
Gokul
1 Like
Hi @Gokul001 , Thank you so much for the help.
Gokul001
(Gokul Balaji)
March 15, 2022, 2:00pm
5
Cool @Sirimalla_Karthik_Chandra
happy automation
Regards
Gokul
Hi @Sirimalla_Karthik_Chandra
Since you said that there are a lot of .txt files, using a For each will work, but might make the bot slow.
Another approach you can take is by using LINQ filters in the following way:
1- Define an array containing the desired Filenames:
2- Get list of files in folder:
Directory.GetFiles("YourPathHere")
3- Apply the following LINQ:
var_ListOfFiles.Where(function(x) var_SpecificFileNames.Any(Function(y) x.Contains(y))).ToArray
This will return in “var_ResultListOfFiles”, the full path of any item included inside the 1st array, if found.
Check the attached workflow if needed!
Demo_ListOfFiles.xaml (7.3 KB)
Best Regards
Hi @ignasi.peiris , Thanks for replying to the post. My query is already solved by @Gokul001 .
system
(system)
Closed
March 18, 2022, 2:14pm
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.