Forum Discussion

Yasir's avatar
Yasir
New Contributor
3 months ago
Solved

How to verify a downloaded file with dynamic File name

I have to verify a downloaded file but some part of the file name keeps on changing while the other part remains constant.(eg Test1534. Test5462, Test5363)

Your help on this would be appreciated...

  • Did you see the method FindFiles, which searches a folder for files matching the specified pattern?

     

    You need to write a function to retrieve a list of files matching your pattern. The file with the latest date, implies it's the latest downloaded file. 

4 Replies

  • Yasir's avatar
    Yasir
    New Contributor

    This doesn't cater my requirement as none of the methods in  aqFileSystem Object Methods accepts a partial file name. If for instance, my file name is TestFile399766. So the path I am bound to provide is "C:\\MyFiles\\TestFile399766.xlsx". I want something that would work as a 'contains check' e.g.

    "C:\\MyFiles\\TestFile*.xlsx"

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Did you see the method FindFiles, which searches a folder for files matching the specified pattern?

     

    You need to write a function to retrieve a list of files matching your pattern. The file with the latest date, implies it's the latest downloaded file. 

  • Yasir's avatar
    Yasir
    New Contributor

    Yes, by using a combination of FindFiles and other methods, I was able to get to the file.

    Thanks rraghvani