Skip to main content

rclone Purge

rclone purge removes a directory and everything inside it — files, subdirectories, nested content, all of it. It's the fastest way to completely remove a path from a remote.

Nuclear Option

purge is the most destructive rclone command. It removes everything under the given path with no filtering. Unlike delete, you cannot use --include or --exclude patterns — it removes everything.

Basic Syntax

rclone purge REMOTE:PATH [flags]
# Remove an entire directory and contents
rclone purge remote:my-bucket/old-project

# Dry run first
rclone purge remote:my-bucket/old-project --dry-run -v

Key Flags

FlagDescription
--dry-run / -nPreview what would be deleted
--verbose / -vShow what's being removed
--log-file PATHWrite log to file
info

purge intentionally supports very few flags — it's designed to be a simple, total-removal command. For selective deletion, use delete with filters instead.

Practical Examples

Remove an Old Backup Set

# Preview first
rclone purge remote:backups/2023-archive --dry-run -v

# Execute
rclone purge remote:backups/2023-archive -v

Clean Up a Failed Migration

# Remove incomplete migration data
rclone purge remote:migration-staging -v

Remove Test Data

rclone purge remote:my-bucket/test-data -v

Purge with Logging

rclone purge remote:old-project \
--log-file /var/log/rclone/purge-$(date +%Y%m%d).log \
--log-level INFO -v

purge vs delete vs rmdir

CommandRemoves FilesRemoves DirectoriesFiltering SupportUse Case
purge✅ (all)Total path removal
deleteWith --rmdirsSelective file cleanup
rmdir✅ (empty only)Remove single empty dir
rmdirs✅ (empty only)Remove empty dirs recursively

Common Pitfalls

PitfallConsequencePrevention
Purging the wrong pathEntire directory tree permanently deletedTriple-check the path; --dry-run first
Purging a bucket rootAll data in bucket destroyedNever run on remote: alone
Expecting filter supportpurge ignores --include/--excludeUse delete for filtered removal
No backend trashUnrecoverable data lossCheck backend trash settings before purging

What's Next

Examples with Output

1. Completely remove a project directory

Nuke a folder and everything inside it instantly. Command:

rclone purge gdrive:OldProject

Output:

(Directory and all contents removed from Google Drive)

2. Dry run of a total purge

Verify exactly which path is about to be destroyed. Command:

rclone purge remote:test-data --dry-run -v

Output:

2024/01/15 12:00:00 NOTICE: test-data: Not purging as --dry-run is set

3. Purge a local temporary directory

Fast cleanup of local working folders. Command:

rclone purge ./tmp_work_dir

Output:

(Directory and contents deleted from local filesystem)

4. Purge a specific subfolder on S3

Efficiently remove a large prefix from a bucket. Command:

rclone purge s3-backup:my-bucket/archives/2022

Output:

(All objects with prefix 'archives/2022' and the prefix itself removed)

5. Check persistence after purge

Confirm the directory is truly gone. Command:

rclone purge remote:gone && rclone lsd remote:gone

Output:

2024/01/15 12:00:00 ERROR : directory not found