Rename each attachment that is saved

Greetings of the day…!!!

I have a task where i have three variable such as Key,Username and date. I am automating the attachment download according to the given subject line. My task is that i need to download the document and save it with the senders username and date of sent in a folder which should be named with the name that is in subject line. To be more clear i will put an example where
key = Java developer, Username=“sujisujendar”,date=18jul2019
I should download the attachment which should be renamed as sujisujendar18jul2019 and should save in a folder named as Java developer.

How can i achieve it by using move file activity i am not able to do since the folder is created only when the attachment is downloaded. So i dont know how to give the path in move file activity.

Please help me
Thanks and Regards
Soumiya S

1 Like

Check this @soumi_soumiya

Hi @soumi_soumiya, the attachment activity can be used for saving into a folder.
2.Then use the move file activity and keep the destination path the same folder path but with different name.
3.Check below screen shot…

Thanks for your reply…
“C:\Users\xyz\Downloads\NameBefore.xlsx”. If this is going to be the existing path i dont know the folder name that is going to be created bcoz i creates according to subject of mail so how can i use this activity

Thanks for your reply…!!
I have a doubt regarding using this movefile activity. i am attaching my design please check it. The folder in which the attachment is going to downloaded will depend on the subject line of the mail so i dont know the folder name in before so how could i give the existing
path and folder name ReadGmailMail.xaml (22.9 KB)

Pass the subject line to the path individually for each attachment and move it. It might take time but you have to do it

Or store the subject lines in an array and while renaming, pass the each subject and move the files @soumi_soumiya

Hi @soumi_soumiya,
You are keeping into the key value folder right ,Which you are taking from the user.
And you are saving with same name of the attachment into that folder?

Hello @soumi_soumiya
You can also use fileSystem.Rename method to rename the file once its in a folder
please check the workflow and understand the logic
Soumii.xaml (14.5 KB)

1 Like

Once check this xaml, i made only some change like in java switch case i kept output for save attachment and it will give the path then moving it to the same folder with different name.ReadGmailMail.xaml (23.4 KB)

1 Like

yes that the way and the downloaded attachment should be renamed

i have stored the mail id and the date in a variable now i should rename the downloaded file with those content in the variable.

i am getting an error …


Are you using the date as the new file name?

Thanks for your reply…!!!

I am attaching my design. Can you help me where should i give the invoke function and i have a doubt whether the invoke function will be able to rename all the attachment that is downloaded ReadGmailMail.xaml (22.9 KB)

Yes filename is a variable that stores the username and dmyy is the variable that stores the date and these bot should be used to rename the attachment that is downloaded or while downloading and key is a variable in which the folder should be created to save the downloaded and renamed attachment

Did you give the extension and are you changing the file names while running the bot again and again because usually that error comes if the file already exists.

Changing the name while bot is running

Hello @soumi_soumiya
Try this i have made changes for java check if its working or not
ReadGmailMail.xaml (25.1 KB)

1 Like

@soumi_soumiya ,

i have changed your code its working fine, Please check it out
ReadGmailMail.xaml (35.7 KB)

1 Like

Thank you sanjay but i am facing an error that it cant create a folder since it already exist but no folders are present in that name what can i should do now