Delete Old Files
Loop through files in a folder and delete all files older than 5 days
This sample task will loop through files in a folder and delete all files older than 5 days. It uses FileDateTime() function, which returns the last modified date and time of a file, as well as the DateAdd() function, which returns a date value a number of intervals from another date.
A variable is created which will hold the value of a file's name when the variable is passed and used in the 'Loop Files' action. Within the Loop there is an 'IF' conditional which is evaluating the file to see how old it is using the functions FileDateTime() and DateAdd().
Make sure that on the "Advanced" tab of the 'Loop Files' action, the 'Include files' parameter is selected and not "Include folders." Also, make sure to create a folder named "Temp" on the root of your C:/ drive or modify the 'Loop Files' action to point to a valid folder.