Archive Files Older Than 30 Days

Archive Files Older Than 30 Days

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.

Task Category:

Functions (Basic)