Loop save email's attachments always saving duplicate attachment name per 1 loop

i have “save attachments” activity inside “for each attachments”. See screenshot below (please ignore the errors):

What i want to achieve is the RPA download attachment 1 by 1 using loop per-1 email.

actually to overcome this, i’m using 2 target folders. This is why i’m use looping for the save attachment:
each loop download 1 attachment, then add ID number for differentiator in the file name, finally move the file into folder 2, after that next process into next loop.

But, the loop is useless because of the save attachment activity downloaded all attachment with same name in each loop =_=

example:
email subject: testing mail
email attachments (the content of the attachment files is different each other):
1] file A.xlsx
2] file B.xlsx
3] file A.xlsx

But the RPA saving attachment like this:

  • 1st attachment loop, saving:
    1] file A.xlsx
    3] file A_1.xlsx
  • 2nd attachment loop, saving:
    2] file B.xlsx
  • 3rd attachment loop, saving:
    1] file A_2.xlsx
    3] file A_3.xlsx

What i want to achieve is:

  • 1st attachment loop, saving:
    1] file A.xlsx
  • 2nd attachment loop, saving:
    2] file B.xlsx
  • 3rd attachment loop, saving:
    3] file A.xlsx

What should i do?

@Yoichi any idea?

Hey! Won’t the mail overwrite the previous file if it’s exactly the same one? I see you want to download the same attachment twice

@wija

That’s the by default case
If you have the same file names then windows will not allow to save the same, It will either replace that or put an increment to that

Try manually to save the 2 files with same name in window then you can get to know

Thanks,
Srini

i understand what u’re saying, so UiPath can’t cheating this?

it will overwrite if overwrite properties is checked and when the same file name already in a targeted folder.
but my case is the all same file name is in a email not in a folder yet.

@wija

It’s running on Windows system, UiPath can’t make that happen, Only tasks which you perform manually can be automated with UiPath

So, when you thinking a task to be done, you need to see whether it is possible in manual or not

Hope this understand you

Thanks,
Srini

actually to overcome this, i’m using 2 target folders. This is why i’m use looping for the save attachment:
each loop download 1 attachment, then add ID number for differentiator in the file name, finally move the file into folder 2, after that next process into next loop.

But, the loop is useless because of the save attachment activity downloaded all attachment with same name in each loop =_=

@wija

You can do one more thing also
You can place create folder and put some dynamic name to the folder and pass the variable to save attachments
So when the loop runs it will create the folder with some name and there the file will store

Hope this may help you

Thanks,
Srini

i tried this, the save attachment activity is still downloaded the same file name in each loop and put both the same file name in a dynamic folder.

oh god, i just want to download 1 attachment in each loop. regarding the auto increment in the file name is supposed windows’ job after the attachment downloaded =_= this is clearly lack of reliability of the save attachment activity.

nevermind, i already find my own solution.

I’m not revise my flow, but adding some of key features to outsmart the “save attachments” activity’s weakness, the key feature are:

  1. create list then append to list of string of the attachments’ name,
  2. distinct the attachments’ name from the list,
  3. use “for each file in folder” activity",
  4. in the “for each file in folder” activity, use “rename file” activity",
  5. then move the renamed file in each loop.

finally i get what i wanted.

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