If Excel already exists, how to copy and rename it as Backup

Hi, all.

I need to save the Email attachment to the destination folder. However, if the attachment (.xlsx, .xls, .csv) with same name already exists, e.g. “AAA”, how can I save the new attachment and rename it as “AAA_backup”.

Thx for your help in advance.

@mason_wong - you can try below…

before saving the attachment… check the file already available with pathexists activity… if pathexists - add _backup to the file name else just use the same file name…

  • PathExists - return boolean name like isFileExists
    if isFileExists
    true block - fileName = fileName + “_backup”
    else - ignore
    outside if block add your save attachment logic

Hi…
@mason_wong Hope this will solve your issue…Example.zip (3.4 MB)

hi GBK,

Thank you for your helping. But I’m still struggle with how to “check the file already available with pathexists activity”. Could you pls provide some details about how to do it.

Many thx

hi vamsiyeluri,

thank you for your offering. I have went through your coding, but still not sure how to use it.

Hi… @mason_wong

I made a video for a demonstration, please walk through it. I have clearly explained how to do it . MailAttachmentsDownload.xaml (15.2 KB)

1 Like

thank you so much

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