How to save excel file in particular folder and check the Downloaded date

Hi All,

i want to download the file to a particular folder and check the downloaded date, if it is not today’s date then delete it.
image
it is automatic taking and i want to save it in some folder and variable is “str_FilePath”.
once saved i need to check when it is downloaded, do we have any option to check modified date? so that next day if bot runs it should compare the date.

Thanks in advance

Hi @Rakesh_Tiwari

You can check like this:

For file info, you can use file info activity.

fileInfo.LastWriteTime.Date < DateTime.Today

or

Directly use this by passing the file path.

File.GetLastWriteTime(str_FilePath)

Hi @Rakesh_Tiwari
If
fileInfo.LastWriteTime.Date <> Now.Date

Hope it helps!!

Thanks for your reply.

how to save file in particular folder

@Rakesh_Tiwari

You can use move file activity to move the downloaded file from one folder to another.
or
use copy/paste file activity to save the file in another folder.
or
You can automate the saving file in specific folder by disable ask to the save file before downloading.

no, we are providing business accessibility to save the file anywhere by them.

i am using file exist activity to check if file is exist for today, but i believe it is checking time as well which i do not want.


how to check for date only and not check for time.

@Rakesh_Tiwari

This will give the only date.
Datetime.Now.Date

1 Like

Hi @supriya117 ,

after using above expresion, if conditon is failed, it is going to else part which is wrong.

Try printing the output and check if that is the desired output or not.

@Rakesh_Tiwari

It is failing because of extension I beleive

please try this Path.Combine(str_FilePath,"GUIDFile_" + Now.ToString("MM_dd_yyyy") + ".xlsx")

change extension as needed and I hope your str_filepath has the folder and not the file

cheers

1 Like

Thanks @supriya117 and @Anil_G .

both expression are working fine, i wish i could select multiple solution.

Thanks
Rakesh
Happy Automation
Cheers

1 Like

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