Delete Files Older Than X Days

This Automation Manager object deletes files older than a given number of days.

Privileges

Normal

Input Parameters

Name Type Required Description
File Pattern String Yes The file name pattern to match.
Full Path String Yes The full (UNC) path of the folder where files will be deleted.
Older Than days Number Yes Files older than this number of days from the current date, that match the file pattern will be deleted.

Output Parameters

Name Type Description
Result Number Returns a success value of zero, or any value other than zero to indicate failure.
Result String String Object execution error details.

Example Input Parameters

Name Type Description
File Pattern String *.txt, or Name*.txt
Full Path String C:\folder1\folder2\
Older Than days Number

10

Partial days can also be used.

  • A choice of 0.5 day results in the removal of all files that are older than 12 hours as of the time of policy execution. For example, files that are 18 hours old when the policy is run will be deleted.
  • A choice of 1 day results in removal of all files that are older than 24 hours as of the time of policy execution. For example, files that are 47 hours old when the policy is run will be deleted.
  • A choice of 2 days results in removal of all files that are older than 48 hours as of the time of policy execution. For example, files that are 49 hours old when the policy is run will be deleted.