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.
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
| Flag | Description |
|---|---|
--dry-run / -n | Preview what would be deleted |
--verbose / -v | Show what's being removed |
--log-file PATH | Write log to file |
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
| Command | Removes Files | Removes Directories | Filtering Support | Use Case |
|---|---|---|---|---|
purge | ✅ | ✅ (all) | ❌ | Total path removal |
delete | ✅ | With --rmdirs | ✅ | Selective file cleanup |
rmdir | ❌ | ✅ (empty only) | ❌ | Remove single empty dir |
rmdirs | ❌ | ✅ (empty only) | ❌ | Remove empty dirs recursively |
Common Pitfalls
| Pitfall | Consequence | Prevention |
|---|---|---|
| Purging the wrong path | Entire directory tree permanently deleted | Triple-check the path; --dry-run first |
| Purging a bucket root | All data in bucket destroyed | Never run on remote: alone |
| Expecting filter support | purge ignores --include/--exclude | Use delete for filtered removal |
| No backend trash | Unrecoverable data loss | Check 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