How to find/delete files older than x days?

Looking to find and delete all files older than X days (could be create date or modify date - does not really matter which). I looked at the Find Files and Delete Files actions, and there does not seem to be a way to find or delete files based on relative date. You can specify a specific calendar date, but not “2 days before current date”.

Am I missing something? I see a similar Finalbuilder question that someone asked in 2009, but am unable to view the solution project.



Might have figured it out. Combination of File/Fileset Iterator, GetDate (on each file), GetDateTimeDifference (between the GetDate value and now), and an If statement checking to see if the GetDateTimeDifference is greater than X days. Unless there is an easier way?

Hi Jonathan

Another option is Fileset Filters

Using a DateTime filter and a DateTime Variable

I think I understand how that would work, but it is a confusing screen, because it looks like if it would match either the specified date/time OR the variable date/time it would be part of the fileset. I assume, though, that a variable in this screen would OVERRIDE the specified date/time. Is that correct?

Yes, when you specify the variable the comparison date/time are ignored… I’ll see if we can’t make that clearer somehow.

I actually do not see any tabs for “Include Patterns”, “Exclude Patterns”, or “Filters”. Is that a Finalbuilder thing? I am using Automise - I just see “General”, “Runtime” and “Details”.

EDIT: I am looking at the FileSet Iterator. I realize that you are in the Fileset Define screen. Sorry about that.

1 Like