Hosted~FTP~’s file retention policy feature allows admins to set-up rules in your infrastructure, and when those criteria are met, to automatically delete files in your account. This feature is available starting at the Enterprise T2 bundle and above. Due to using regex in the fields, customers should reach out to the support team for additional assistance and review of the policy before activation.
*Note: Please carefully read the rules and syntax parameters before activating your file retention policy. This is a destructive process that will permanently delete your files and be unrecoverable. We recommend contacting the support team to initially setup your policy rule.
Guidelines #
- The rule is set on the owner of the folder and not the shared folder. (I.e. if you add a username in User + and they have read/write permissions to a shared folder – the rule will not work)
- Acceptable total file limit: Folder owner must own less than 250,000 files
- The Folder+ field should target a specific folder (e.g. /FinanceDepartment/Inbound/) without using a regular expression (such as * or .*).
- Each Retention policy in a multi-tenant environment must include less than 100 folders/subfolders (combined) total.
- Files are deleted based on their “created date” which is defined as the date when the file was uploaded to the FTP site. Although the FTP and SFTP protocols allow you to set the last modified date to be different from the created date, the file retention policy feature works only against the created date.
- Empty folders/sub-folders are not deleted regardless of the last modified date.
- Files are deleted permanently. After the file retention policy deletes a file, it cannot be recovered.
- The policy will run only once a day overnight, you will not see the results until the next day.
Adding a New File Retention Policy #

Going to the Policy tab, you’ll find a list of your existing policies in place to manage, or add a new policy. Click on the Add button located on the right-side menu to add a new policy. Please see table below to understand what to input into each field.
Regex Syntax Parameters #
- Beginning of a folder path must have two forward slashes (//). i.e. //Mainfolder
- Ending of folder path can have .* (targeting all files)
- Multiple folder paths or users can be separated by a space ” “.
- If a folder path has a space, replace with syntax s i.e. /Main folder must be inputted as //Mainsfolder

| Field | Description |
| Policy Name | Name of the policy |
| Action | Default is Delete. Cannot be changed. |
| User + | Include the folder owner usernames for where you want to target the file retention policy for. |
| User – | Exclude users who you do not want to be affected by this policy |
| Folder + | Specify the folder path (You can enable the include subfolders option).
Multiple folder paths are separated by a space, whereas spaces in the folder path are replaced with a s Example 2 folder paths with a space: /Mainfolder/sub folder and /Mainfolder/sub folder 2 will become //Mainfolder/subsfolder/.* //Mainfolder/subsfolders2/.* Note: Add a / in front of the top level folder i.e. //Mainfolder/subfolder/ |
| Folder – | Exclude folders here separated by a space between multiple folder paths |
| File + | Use a * to include all file extensions, or include specific file extensions with regex /.*. and separate by a space i.e. .PDF would be /.*.PDF |
| File – | Exclude file extensions here |
| Other Criteria | Default is The uploaded date is older than. Cannot be changed. |
| Time Amount | The amount of the unit specified |
| Time Unit | Select your unit to measure the time amount: days, weeks, months, years |
| JavaScript | Include any JavaScript here to customize the policy (contact support@hostedftp.com for additional assistance) |
| Active | Check marking this option will enable the policy. Un-checking the option will disable the policy. |
Once your settings have been confirmed, please click on Save to keep your policy saved. If the Active checkbox is enabled, as a result, it will also turn on the policy immediately. The policy will run only once a day overnight, you will not see the results until the next day.