Forum Discussion

Dk_3108's avatar
Dk_3108
Occasional Contributor
4 years ago

How Identify a file name with time stamp in Test complete using Python Scripts

Hi ,
I have a scenario to validate whether the downloaded file exists in a folder ,I have used the below script to validate whether the file name exist or not.

However the downloaded file has a name reference with date and time as a result the below script is failing to identify the file name since the date and timestamp changes whenever the respective file is downloaded.

 

Can someone help me on this as i am new to Test complete and Python.

 

 

def FileExist():
filepath="C:\\Users\\dkaliyugavarathan\\Downloads\\Order_Extract_Export_2022-03-10_20-42-32.csv"
if aqFileSystem.Exists(filepath):
Log.Message("Order extract export file downloaded successfully! ")
elif not aqFileSystem.Exists(filepath):
Log.Message("Order extract export file does not exists")

 

 

Thanks in advance!..

3 Replies