Finding a file in my documents

Good Afternoon,

I am trying to search for a file name in my documents and am unsure how to do this. I have received an email with the file name I am looking for in an email. I have already stored this file name as In_filename. Now I want to search in my documents to see if this is there. If this is there, then I want to rename the file as


Any Ideas on how to do this?

–hope the variable in_filename has the value we want
–now use a assign activity and mention like this
arr_filepath = Directory;GetFiles(“yourfolderpath”,".")

where arr_filepath is a variable of type array of string
–now use a FOR EACH activity and pass the above variable arr_filepath as input
and change the type argument as string in the property panel of for each loop
–inside the loop use IF condition like this
if this condition is true it will go to THEN part where use a ADD TO COLLECTIONS activity where in the collection property mention as list_filechangedpath, a variable of type system.collections.generic.list(of string) with default value as new list (of string) defined inthe variable panel
and in the item property of add to collections activity mention as item.ToString

–now all the file path that matches the condition will be added to the list variable
–followed by this for each loop use another for each loop and pass the above list variable list_filechangedpath as input and change the type argument as string inthe variable panel
–inside this loop use a MOVE FILE ACTIVITY where in the property path mention as item.ToString and in the Destination property mention as

hope this would help you resolve this
Cheers @amb13


I am actually going to be looking for this file name on my drive. Is there an easier way to do this?


Try with this one, you will get list of Fileinfo, you need to have a variable with List(of FileInfo) datatype to hold the result from the below query.

Directory.GetFiles("yourDirecotryPath").[Select](Function(f) New FileInfo(f)).Where(Function(f) f.FullName.ToString.Contains(In_filename)).ToList()


SearchMyDocuments.xaml (6.5 KB)

Check this xaml and let me know if any issues.

I am trying to find the name of the file in my one drive and once I find it I will rename that file with hidden_filename.


Have you connected to your one drive from UiPath?


I just use the link to my one drive and open browser and that works. I was thinking of using a Get OCR Text and then an anchor base to simulate the click so that I can rename the file. Would this work?