UI path overwriting .pdf attachments with same name while downloading from outlook



I am not sure whether this was asked before, however i tried searching and did not get exact solution.

I am trying to download pdf attachments from certain mails with certain subject lines, things work fine except that UI path is overwriting the attachments with the same name(keeping the latest one only).I tried using time stamp, yes that works but few attachments still are having the same name as defined whereas majority of them are coming with time stamps(i don’t know why it does not put time stamp for the starting few attachments).
Is there any way without using time stamp that UI path automatically put suffix for every attachment with same name and does not overwrite.
eg.-If an attachment has name xyz and if another attachment comes it should be named xyz_01 and not overwritten.



you can go through all the Files in a Directory with a For-Each Activity and Directory.GetFiles(“Path-To-Directory”) in the Value Section. Then you compare the Values(Strings) which are already there and then pick the Number that was not yet used.



You could set up a counter for each attachment that’s downloaded, and increment by 1. It would add a number onto the end of all files, not just the duplicates, but it would guarantee none have the same name.


Hi Subhani,

  1. use save attachment activity then name the file with timestamp with hh/mm/ss

  2. if it is in loop give some delay 1 or 2 seconds


Thanks @rajsekhar @KEntwistle @BobBuilder for you help, combination of all the 3 solutions helped me achieve what i wanted.
Thanks again.