I need to read multiple file paths from an excel and delete files which are more than 30 days

I need to read multiple file paths from an excel and delete files which are more than 30 days

Hi @kushal.vetsa

Welcome to the UiPath Community

Need more information about the 30 days, whether it is Creation Time or Last Write Time.

In order to know the age of file (from creation time) use this

(Now-File.GetCreationTime("C:\TestFolder\image.png")).Days

you have to replace the path with path of your file

@kushal.vetsa

Suppose your excel file contains data like below

image

You can design the work flow like below

For your reference

read multiple file paths from an excel and delete files which are more than 30 days.xaml (6.5 KB)

@kushal.vetsa

The file paths are incomplete. The extension of files are missing. Shift + right click on the file and then select copy as path option and then paste the path in excel.

@kushal.vetsa

Clarify if the excel contains folder path or file path.

Also, the topic you created gives information that the excel contains only file path. Change the topic title and description accordingly.

@kushal.vetsa

For the input excel file like below

image

Check the updated xaml file

read multiple file paths from an excel and delete files which are more than 30 days.xaml (8.7 KB)

This can further be optimized by using the root directory path which contains all the folders. For that I would suggest to explore the Directory.GetFiles() method.

1 Like

@kumar.varun2

Thanks for the Solution. Its working :grinning:

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