Archive Files Older Than 30 Days

by Dallas Li, in Task or Workflow of the Month, posted 4/23/08

This sample task will loop through files in a folder and archive all files older than 30 days. It uses the "FileDateTime" function, which returns the last modified date and time of a file, as well as the "DateDiff" function, which returns the number of intervals between two dates.

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 evaluates the file to see how old it is using the functions "FileDateTime" and "DateDiff".

Make sure that on the "Advanced" tab of the "Loop Files" action, the "Include Files" parameter is selected and not the "Include folders" option.  Also, make sure to create a folder named "Test" and "Test2" on the root of your C:\ drive or modify the "Loop Files" action to point to a valid folder.

To check out the task and download it for yourself, click here.