Duplicate Validation

Hi All,

I am building a bot to download documents from a portal. On few instances - there are duplicate files which needs to be saved by renaming them I am unable to define the pre-condition.

I would get to know this only on save as window while saving the file. How do i predefine the condition from here.

Hi @balaji.nama,
To Automate this, follow the below steps-

  1. Use assign activity, and get a collection of files from the download folder
  2. Use for each loop (collection of files in folder)
    3. Get 1st file name (ex: Abc.xls)
    4. Navigate to website and download file(write the logic to download file during next iteration )
    5. (Get the file name which you are downloading, eg Abc.xls)
    6. Compare step 3 and 5 using IF condition
    7. if true rename the downloaded file Else do nothing

@balaji.nama
Another technique is to fill up maintain the filenames and uplicates within a dictionary (of String, string)

While downloading check if the filename is available as key in the dictionary e.g. dictNames
If Not avaialable: insert the filename as Key and Value: e.g. dictNames(“Abc.txt”) = Abc.txt
If Available:

  • retrieve the value val = dictNames(“Abc.txt”)
  • do the modification on the filename e.g. Abc_2.txt
  • store the new filename back dictNames(“Abc.txt”) = Abc_2.txt

Sure you can modify the pattern and e.g store a filename counter on the value

1 Like