Delete excel files in destination folder after 60 days

file

#1

Delete excel files in destination folder after 60 days…

In a folder i have excel files,
using - > Directory.GetFiles(DestinationFilePath, “*.xls”) i am getting excel files
after that using foreach loop i am looping through each file ,

but after that how to get creation date and compare with present day…


How can you check if there is a new file in a folder?
#2

Hello!

Follow in attach an example to get the creation date of all .xlsx files in a folder.

GetCreationDate_Example.zip (6.8 KB)

Any doubts please let me know.

Hope It’s helps!

Regards,


#3

Hi Lucas,

It says cannot open empty zip folder.

Thanks,
Swarna


#4

Oh, sorry.

Try this.

Main.xaml (7.0 KB)

You just have to put some Excel files (.xlsx) on the xaml folder.

Regards,


#5

Lucas,

In the Main.xaml file that u have sent, where can I pass destination folder path. Because I have a folder path from where all excel files are looped through.


#6

hi @swarna

Please try this attached sample solution for you.

just replace the folder path to your destination folder.

SwarnaSolution.xaml (6.7 KB)

Regards…!!
Akshay


For each excel in a folder
#7

The destination folder can be pass on the dirInfo variable default value:

New DirectoryInfo(System.IO.Directory.GetCurrentDirectory )
New DirectoryInfo(“folderPath”)

Regards,


#8

Thank you it works with folder path…


#9

Thank you Lucas, it works.