Limit number of files on remote

(sorry in advance if this is easy, I browsed docs and forums and couldn't find an answer)

What is the problem you are having with rclone?

My server creates a backup every day that overwrites the previous backup. So there is only ever one backup on the server (it's small) which consists of a few files in /backup.

I'd like to copy the contents of this /backup folder to Dropbox every day, but limit the number of backups in Dropbox so it doesn't endlessly grow. I'd like to keep for e.g. two weeks worth of backups in Dropbox.

I had hoped for a --maxRemoteFiles=14 flag which limited the number of files in the Dropbox folder to 14, deleting the oldest when new ones were added.

Is there some way of doing this in Rclone that I'm missing? Feels like quite a common use case?

Run the command 'rclone version' and share the full output of the command.

rclone v1.50.2
- os/arch: linux/amd64
- go version: go1.13.6

Which cloud storage system are you using? (eg Google Drive)

Dropbox.

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone copy /backup my-dropbox:/rclone-backups/site-name --maxRemoteFiles=14

hello and welcome to the forum,

--- best to update to latest stable v1.58.0

--- rclone does not have the feature, would need to script it.

--- might check out these flags.
--min-age=14d - list files older than 14 days.
--backup-dir
--suffix

Thanks. I guess I can just run this after the copy command actually:

rclone delete --min-age 30d my-dropbox:/rclone-backups/site-name

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.