Create new file if doesn't excist

Hi team,
I need the BOT to find in FY2020 folder to check if "TMU 0011 P06’20.XLSX’ exist or not. If it does not exist then BOT will copy the template savein any other drive to this folder and Rename it to be "TMU 0011 P06’20.XLSX’ .
Template file maybe like "TMU 0011 P03’20.XLSX’ .

BOT needs to check in FY2020 folder for the files on the basis of periods to be P03’20,P06’20,P09’20,P12’20… that if the files not present for any of these then BOT will copy the template from local path and paste it in the FY2020 folder and rename it to be:
"TMU 0011 P03’20.XLSX’
"TMU 0011 P06’20.XLSX’
"TMU 0011 P09’20.XLSX’
"TMU 0011 P12’20.XLSX’


To check the file, Use Path Exists activity-> Provide the full path in that activity

It will returns True or False

Use IF condition and you can place the next logic

Mark as solution if this helps


Assign a variable to store an array of string (This is to get all excel file in a particular folder path)
E.g Out_AllExcelFile = Directory.GetFiles(“C:/Desktop/FY2020”,”*.xlsx”)

Do a for loop on Out_AllExcelFile

If item.ToString.Contains(“P03”) just create multiple if for / switch P03/P06/P09/P12
If it does not exists then use copy file function (You can rename it from here)

Mark as solution if this helps


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.