Renaming file name while downloading form the email

Hi, I want to rename the profile name when I download/save in a folder.
I want to keep the save name of attachment just add the random number before it’s name.
Like my attachment name is Profile. I just want to add the variable which I already extracted data, want to add with the attachment name.
Expected output should be like this. 10000 Profile
@Palaniyappan @lakshman
@HareeshMR can you help to resolve this issue

Please check How to rename the Attachments and save them?

1 Like

Already checked this link this is something diff. My requirement is diff.

Use move file activity to rename or c# method ```
System.IO.File.Move(“oldfilename”, “newfilename”);

1 Like

dear latter I want to use move activity, I have perform other operation after renaming it. So that’s way I want to rename it while downloading. I know I can do after downloaded. Hope you got it.

Hi @balkishan as i know while downloading the attachment you can’t rename move the file to the same path so that old file will not be there

1 Like

@Jan_Brian_Despi can you help to resolve this issue.
Renaming a attachment name while download from the email .

1 Like

Hi @balkishan,

Hello :slight_smile:
What we can do here is we first download the attachment then rename it afterwards.

Thank you :slight_smile:

2 Likes

How can you rename it after download???
@Jan_Brian_Despi

Hey @balkishan!
Yes, we can :slight_smile:

2 Likes

*Let us assume that the attachment is only 1.
Once you use the Save Attachments activity, there is an Output called Attachments.
Get the output.

  1. Let’s say that the variable name is attachments. So we will use attachments(0).ToString to get the file path. Assign that to a variable (strFilePath).
  2. Get the directory and file name of the file path.
    a. To get directory: Path.GetDirectory(strFilePath). Assign it to strDirectory
    b. To get file name: Path.GetFileName(strFilePath). Assign it to strFileName
  3. Once you already got the two, edit strFileName to your desired file name.
  4. Concatenate: strDirectory + “” + strFileName. Assign it to strNewFilePath
  5. Use Move File.
    a. Path: strFilePath
    b. Destination: strNewFilePath

Then you’re good to go.
Thanks and regards :slight_smile:

4 Likes

Sure @balkishan, you can use it :slight_smile:
It is the same :slight_smile:

2 Likes

If you observe bro point 5 option b. Destination: strNewFilePath is a file name after rename it not a Directory as you mentioned.
BTW It’s worked I modified it Thanks a lot.

2 Likes

Yeah. Good point. Haha.

2 Likes

EmailAttachment.xaml (8.3 KB)

Here you go. Just change Email, Password and File locations in two variables “FolderLocation” and “OutputLocation”

See that they are different folders, since this flow will throw an excpetion if they are in the same folder.

Hope this helps!

1 Like

Hi @srdjan.suc Thanks so much for your efforts, your logic is indeed effective :slight_smile:

2 Likes

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