Automatic Purge Routines

Automatic purge routines perform a routine scan of a target directory, and once a specified capacity is reached, the system will begin to purge files that are older than a date you specify.

Note: Automatic Purge functionality is not supported for storage groups used by iPhone Live configurations. If the group is associated with this type of configuration, this option will be grayed-out, and you will need to set up automatic purge at the stream level. Please contact your account representative for additional assistance.

How to setup a purge routine

To set up a routine, click the + Automatic Purge button and set these options as necessary:

Option Description
Upload Account This is the upload account that will use this purge. The upload accounts listed have been associated to, and are used to access a specific upload directory within a storage group.
Upload Directory This defaults to the root of the upload directory associated with the selected upload account. You can target preexisting subdirectories to be purged as needed.
Note: Use the Upload Account entity to configure upload directory associations for your storage group.
Purge When The Directory Reaches Input a non-zero, positive decimal and select the appropriate file size type from the drop-down (Bytes, KB, MB or GB). When the specified value is reached, the purge will be initiated.
Note: This functionality uses sub-directories and their content when determining overall directory size. However, only contents within what is set in the Upload Directory field will be targeted by the purge (unless the Recursive Purge option is enabled).
Recursive Purge With this option enabled, subdirectories within the specified Upload Directory will also be targeted, and their contents will be purged. If left disabled, only files within the actual Upload Directory will be purged. Purge routines don't delete empty, explicit directories and must be deleted manually.
Only Purge Content Older Than (in days) Input a non-zero, positive integer to represent the desired number of days. (For example, insert “10” to represent files 10 days older than the current date.) Once the value set in the "Purge When The Directory Reaches" field is reached, files older than this date will be purged.
Note: If no content is older than what you’ve specified here, nothing will be purged--even if the directory size exceeds what is defined in the Purge When The Directory Reaches field.
File Exclusion Regular Expression Using POSIX Extended Regular Expression syntax, input file names/types that should be excluded from the purge. Some basic examples of use include the following:
  • \.html$ - To exclude all “.html” files.
  • /index\.html$ - To exclude all instances of the file named “index.html”.
  • b - To exclude any file with the character “b” anywhere in its pathname.
  • /[0-9]+$ - To exclude all files whose filenames consist of numbers.
  • /trash/ - To exclude all files in any directory named “trash” (i.e., throughout the path).
  • ^/files/test/only\.new\.foo/5\.bat$ - To explicitly exclude the file, “5.bat” which exists in the path, “/files/test/only.new.foo/”.
Note: File Exclusion Regular Expression takes precedence over File Selection Regular Expression, below (i.e., if a file/path match a regular expression input set for both options, the EXCLUSION will occur).
File Selection Regular Expression Using POSIX Extended Regular Expression syntax, input file names/types that should explicitly be included in the purge. These file types/names will be targeted first in the list of applicable files for the purge. The same examples cited above apply with this option as well, except those files would be included.
Note: Basic wildcard-type patterns are not supported, only POSIX Extended Regular Expressions. For example, while “foo*” matches any filename beginning with “foo”, it also matches filenames containing "fo" (e.g., "file.fo_g", "c_fo" and "ox_fo_rd.txt".) And “test.*” doesn't just match "test" with any filename extension. It also matches "cu_test_.mp4" and "data.la_test_".

Purge routines don't delete empty, explicit directories

If you create an explicit subdirectory in a root that you've targeted for an Automatic Purge Routine, the subdirectory itself will not be deleted, even if you have enabled "Recursive Purge." You will need to manually delete the subdirectory. In the case of an implicit subdirectory in NetStorage, this is not an issue. Since these subdirectories are "virtual," once the content within the target root is purged, these directories just cease to exist. For example, the path "<CP Code Root>/uploads/a/b/c/" exists in a storage group in one of two ways:

  • The entire path is explicit: This indicates that you manually created each subdirectory in the path explicitly, and are uploading content to it. If you target "/uploads" for a recursive purge, you will need to manually delete the subdirectories "/a," "/b" and "/c."
  • Only "/uploads" is explicit: This indicates that you performed an upload operation, and set the path, " /a/b/c" in the request, thereby making those subdirectories implicit. When you target " /uploads" for purge, all of its contents will be deleted and the implicit path, "/a/b/c" will just cease to exist.

Purge routines don't delete empty, explicit directories

If you create an explicit subdirectory in a root that you've targeted for an Automatic Purge Routine, the subdirectory itself will not be deleted, even if you have enabled "Recursive Purge." You will need to manually delete the subdirectory. In the case of an implicit subdirectory in NetStorage, this is not an issue. Since these subdirectories are "virtual," once the content within the target root is purged, these directories just cease to exist. For example, the path "<CP Code Root>/uploads/a/b/c/" exists in a storage group in one of two ways:

  • The entire path is explicit: This indicates that you manually created each subdirectory in the path explicitly, and are uploading content to it. If you target "/uploads" for a recursive purge, you will need to manually delete the subdirectories "/a," "/b" and "/c."
  • Only "/uploads" is explicit: This indicates that you performed an upload operation, and set the path, " /a/b/c" in the request, thereby making those subdirectories implicit. When you target "/uploads" for purge, all of its contents will be deleted and the implicit path, "/a/b/c" will just cease to exist.