I am trying to write UiPath Automation Script to look for a file in specific format and if true send me an email otherwise email me saying file does not exists.
See below as file format, everything it changes with today’s date.
I am trying to write a script that would send me email if file is found and if not found with this specific format daily then it would email me stating no file exists. I am using If and Else statement.
I am trying to write a script that would send me email if file is found and if not found with this specific format daily then it would email me stating no file exists. I am using If and Else statement…
Thanks so I would have still expected to receive an email stating “File Does Not Exists”.
I just tried updating the file name to today’s date and its still not working. For some reason its not finding the file.
1.1 Main Sequence (Sequence)
Private = False
Variables out_FileExistsX_1__Exists(Boolean)
Activities
1.25 File Exists (FileExistsX)
Path = "\epic-nas.et1157.epichosted.com\xfr\nonprd\toODB\Claims\PBClaims\CRD\TEST1\archive"+"EPICTRAN"+Now.ToString(“yyyyMMdd”)+“*.txt”
Exists = _out_FileExistsX_1__Exists
Private = False
1.11 If (If)
Condition = _out_FileExistsX_1__Exists
Private = False
Then
1.15 Sequence (Sequence)
Private = False
Activities
1.16 Use Desktop Outlook App (OutlookApplicationCard)
Account mismatch behavior = UseDefaultEmailAccount
Private = False
Body
1.17 Do (Sequence)
Private = False
Activities
1.18 Send Email (SendMailX)
Account = Outlook
To = Nirmit.Kansagra@rwjbh.org
Subject = FILE EXISTS
Save as draft = False
Importance = Normal
Sensitivity = Normal
Max body document size = 2
Body type = Html
HTML body from file
HTML Template = .data/HtmlContent0.html
Private = False
Else
1.14 Sequence (Sequence)
Private = False
1.2 Use Desktop Outlook App (OutlookApplicationCard)
Account mismatch behavior = UseDefaultEmailAccount
Private = False
Body
1.3 Do (Sequence)
Private = False
Activities
1.4 Send Email (SendMailX)
Account = Outlook
To = Nirmit.Kansagra@rwjbh.org
Subject = FILE DOES NOT EXISTS
Save as draft = False
Importance = Normal
Sensitivity = Normal
Max body document size = 2
Body type = Html
HTML body from file
HTML Template = .data/HtmlContent1.html
Private = False
and also recheck the parent folder path as we do feel that after archive the \ was missing in your sample, but we assume that the file name starts with EPICTRAN
So I tried with the updates mentioned, however, now I am hitting another error stating Main.xaml: BC30512: Option Strict On disallows implicit conversions from ‘Boolean’ to ‘String’. The selected value is incompatible with the property type.
This LINQ retrieves all files in the specified path and checks if any of them start with the desired naming format while ensuring the file extension is .txt. It returns a boolean, making it suitable for use directly in the condition part of the ‘If’ activity.
Sorry one last question, is there anyway I can configure this script, where once it finds the file, it spits out name of the file and have that emailed to me the name of the file.
I am looking to get alert setup where if file is received by 2pm, have alert go out to me stating CRD file “EPICTRAN_20241010111358930” was received. I want the exact file name to spit out.
Sorry one last question, is there anyway I can configure this script, where once it finds the file, it spits out name of the file and have that emailed to me the name of the file.
I am looking to get alert setup where if file is received by 2pm, have alert go out to me stating CRD file “EPICTRAN_20241010111358930” was received. I want the exact file name to spit out.
we suggest to scope one topic = 1 case
So, other researchers can find the solution for their similar use cases
the origin topic was answered (temporary you closed it also by solution mark)
just close this topic and open a new one for your last question
new System.IO.DirectoryInfo("strFolder ").Getfiles("EPICTRAN_*.txt").Where(Function (x) x.Name.Contains(Now.toString("yyyyMMdd"))).Select(Function (x) x.Name).toArray
for example will a return a string array with all found file names