<< Back to tutorials

Auto Cleanup Rules - Automatically Delete Old Files

Published {$created} by Carsten Blum


Many ftpGrid users rely on the platform for continuous uploads — especially for video surveillance cameras, IoT devices, and automated systems. These systems often generate files around the clock. Without a retention policy, storage usage will eventually grow until it reaches the storage quota. To solve this, we’ve introduced Auto Cleanup Rules — a simple way to automatically delete files older than a specified number of hours or days. Auto cleanup makes ftpGrid particularly useful for camera storage, IoT pipelines, log rotation, and temporary file hosting, where new files are constantly uploaded.


Auto cleanup retention rules

Automatically Delete Old FTP Files

Many traditional FTP servers do not include built-in retention policies. Administrators often rely on cron jobs or scripts to periodically delete old files.


With ftpGrid Auto Cleanup Rules, this can now happen automatically. You can configure ftpGrid to delete FTP files older than a specified number of hours or days, ensuring your storage never grows beyond the desired retention window.


FTP Retention Policy Made Simple

An FTP retention policy defines how long files should remain stored before being deleted.

In many environments, such as video surveillance or automated log uploads, files are constantly generated. Without a retention policy, storage usage grows indefinitely.

Auto Cleanup Rules allow you to define a simple FTP retention policy directly in ftpGrid without scripts or manual maintenance.


What Are Auto Cleanup Rules?

Auto Cleanup Rules allow you to automatically remove files based on their age and directory path.


You define:

  • A description of the rule

  • A time threshold (hours or days)

  • A folder path where the rule applies

  • Whether empty directories should be removed

Once configured, ftpGrid periodically scans the selected folder and deletes files older than the defined threshold.



Typical Use Cases

Video Surveillance Storage

Security cameras often upload images or video clips continuously.

A cleanup rule can keep the most recent footage while automatically deleting older files.


Example rule:

  • Delete files older than 7 days

  • Path: /uploads/cameras

This ensures your storage always contains the latest recordings while staying within quota limits.


IoT Device Logs

IoT devices may upload logs every few seconds or minutes.

Cleanup rules allow you to keep recent logs while removing older ones.


Example rule:

  • Delete files older than 48 hours

  • Path: /uploads/iot


Temporary File Storage

If ftpGrid is used as a temporary file exchange platform, cleanup rules can automatically remove files after a short period.


Example rule:

  • Delete files older than 24 hours

  • Path: /uploads/tmp


Automated Data Pipelines

Applications sometimes upload exported data, reports, or temporary files.

Cleanup rules help ensure these folders never grow indefinitely.



Step-by-Step: Creating an Auto Cleanup Rule


Step 1 – Open the Auto Cleanup Section

Log in to your ftpGrid dashboard and navigate to the Auto Cleanup section.

Click Create rule.


Auto clean up retention rule create

Step 2 – Add a Description

Enter a description that explains the purpose of the rule.


Examples:

  • Delete camera footage older than 7 days

  • Remove IoT logs after 48 hours

  • Clean temporary uploads daily


Step 3 – Define File Age

Next, configure the time threshold.


You can specify:

  • Number greater than 0

  • Unit: Hours or Days

Example configurations:

  • 7 Days → typical camera storage retention

  • 48 Hours → log cleanup

  • 24 Hours → temporary uploads


Step 4 – Select the Folder Path

Choose the folder where the rule should apply.

The cleanup process will scan the selected path including all subdirectories.


Example paths:

/uploads/cameras

/uploads/logs

/uploads/tmp



Step 5 – Remove Empty Directories (Optional)

You can enable the option:


Also remove empty directories provided in From path


This is useful when systems create nested folder structures, such as:

  • camera recordings grouped by date

  • IoT devices creating device-specific folders

  • backup systems organizing data into subfolders


Step 6 – Save the Rule

Once saved, ftpGrid will automatically enforce the cleanup rule.

The system periodically scans the configured path and removes files older than the defined threshold.

Rules can be review under https://app.ftpgrid.com/app/automation/list, where you can also see files and bytes freed by the rules.


The details of the auto cleanup and retention process is available in the audit log:


Audit log with retention rules


Example: Camera Storage With Automatic Retention

A common setup looks like this:


Camera uploads files to:


/uploads/reolink


Cleanup rule:


Delete older than: 7 Days
From path: /uploads/reolink
Remove empty directories: enabled


Result:

  • Cameras upload continuously

  • Only the last 7 days of recordings are kept

  • Storage usage stays within the configured quota


Auto Cleanup Is Important

Continuous uploads are extremely common today:

  • security cameras

  • IoT devices

  • log aggregation systems

  • automated backup pipelines

Without automated retention, any storage system will eventually fill up.


Auto Cleanup Rules turn ftpGrid into self-managing cloud storage, where old data is automatically removed while new data continues to flow in.


Try Auto Cleanup Today

Auto Cleanup Rules are available in the ftpGrid dashboard and work with any upload method:

  • FTP

  • FTPS

  • SFTP

  • SCP


You can combine cleanup rules with cameras, scripts, backup software, or application integrations.


If you want to explore ftpGrid cloud storage:


https://ftpgrid.com/ftp-cloud-storage/


Or create a free account and start experimenting:


https://app.ftpgrid.com/auth/signup/


Related Guides

Free signup
© 2026 ftpGrid

ftpGrid ApS
Branebjerg 24
DK-5471
Gamby
Denmark

Looking for an all-in-one time tracking, timesheet, and invoicing solution - visit our Devanux sister company Nureti at https://nureti.com.

Preview Devanux’s upcoming project Pictoguide – a visual support tool designed to bring structure and clarity to people with ASD.