How to move the downloaded file in folder, based on the extension?

Hi,
I have downloaded the attachment from outlook mail.


Now I have attachment with different extension like [.csv,.jpg,.xlsx] in folder.
I need to move the same extension file in one folder.
How to do this scenario, Can anyone help me Please?

2 Likes

Hi @jamunatj

1.Check if that condition is match with mail subject or not.
2.Next that mail have attachment or not.

Regards,
Kommi Jeevan.

1 Like

Hi @kommijeevan

I have completed the attachment file downloaded from the outlook mail based on the subject.
Now I want Know, how to move the Same extension file in one folder.

use move file activity.

from: your file path.
To: where you want to move give that file path.

image

1 Like

Hi @jamunatj ,

Using this you can able to find the extension of the file …

New FileInfo("File Path").Extension

Based on the this you can move the files.

Regards
Balamurugan.S

Fine this expression would help you on that
–for example if we want to move only te csv files thhe use a ASSIGN activity with this expression
arr_csvfiles = Directory.Getfiles(“yourfolderpath”,"*.csv")
where arr_csvfiles is a variable of type array of string
–now use a FOR EACH loop and pass the above variable as input and change the type argument as string in the property panel
–inside the loop use a MOVE FILE activity where mention the path property with item.ToString and destination property with the folder path where we want to move this file one by one

similarly use the same expression for other file extensions as well
like this
arr_jpgfiles = Directory.Getfiles(“yourfolderpath”,"*.jpg")
arr_xlsxfiles = Directory.Getfiles(“yourfolderpath”,"*.xlsx")
Cheers @jamunatj

2 Likes

@jamunatj,

Check this xaml, it may help you.

Check.xaml (8.0 KB)

1 Like

Hi @jamunatj

Try this custom activity from Go

1 Like

Hi @Palaniyappan,

Its Working fine But Instead of giving destination path in move file activity how to create the folder
with that extension name ( BOT itself) and move the file in that folder.

we can use CREATE DIRECTORY activity for creating the folder
Cheers @jamunatj

1 Like

@Palaniyappan

I mean, in downloaded file folder (for example: “.csv” extension file is there means bot need to create the folder with that extension name and then have to move the file in that folder.)

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