Cancel files with date creation more tha one month before today

Hello friends,
@AshwinS2 , @arivu96, @Rammohan91, @balupad14, @Florent_Salendres, @vvaidya, @Palaniyappan, @loginerror, @MAHESH1, @Manjuts90

How to delete all the files contained in a main folder with date creation older than a month compared to today?
Can you please share a xaml?
Thank you,


Try this.

  Dim directory As New IO.DirectoryInfo("C:\YourDirectory")

    For Each file As IO.FileInfo In directory.GetFiles
        If (Now - file.CreationTime).Days > 30 Then delete file
    Else skip
1 Like

ClearLogFiles.xaml (9.0 KB)


Check this one, you need to pass the directory path and number of days to compare from today. then it will delete all the files from the directory.


Try it out. Change path and file type

Sequência1.xaml (6,2,KB)

1 Like

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