Sync with a time delayed delete

What is the problem you are having with rclone?

I couldn't find this in the docs and I suspect it isn't possible so I thought I would see if anyone knows a workaround.
I realise when using sync if file no longer exists on the source, it is deleted from the destination. Is there a way to do this but only if the file on the source has been missing for a period of time.
I could use this when I want to have the remote copy as a backup but if I inadvertantly delete a file on my pc It would still remain in the remote for say 1 month before it gets deleted. Giving me a chance to realise the mistake and restore it from the remote.

What is your rclone version (output from rclone version)


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

#### The command you were trying to run (eg `rclone copy /tmp remote:tmp`)  
```rclone --bwlimit "5M:512k" --exclude "Backups.log" --stats=0 --log-file "C:\Data\Backups.log" --log-level INFO clone C:\Data Work:/

#### The rclone config contents with secrets removed.  
```[Work]
```type = drive
```client_id = 
```client_secret = 
```scope = drive
```root_folder_id = 
```token = {"access_token":"","expiry":""}

You can use:

https://rclone.org/docs/#backup-dir-dir

To keep deleted files for a period of time and then remove the backup dir.

Thanks for your help @Animosity022 that looks like it will work nicely. I read the docs but misssed this. There are so many features. It's hard to absorb it all when your starting out with this program. Bt what a great program it is.

hi,

if you want forever forward incremental backups, you can run a command such as
rclone sync C:\Data Work:current --backup-dir=Work:archive/20211111.203743

to delete files older than 30 days, try
rclone delete Work: --min-age=31d --dry-run -v

Thanks @asdffdsa. Rather than an incremental backups I have all the deleted files going into the same directory. (If I change the file more than once in the period it will only retain the last one)
When I run the command "rclone delete Work:/TestToDelete --min-age=14d"

it seems to delete the files that were modified more than 14 days ago rather than 14 days after being moved to the TestToDelete folder. From what I understand the --min-age flag works on the modified date. Is there a way for this command to work on the created date of the file which seems to be the date it was moved into the /TestToDelete folder?
If not is there another way?
Perhaps that is why you suggested using a sub directory.

try https://rclone.org/drive/#drive-use-created-date

rclone lsl gdrive:test 
        0 2000-11-15 15:27:54.706000000 file.txt

rclone lsl gdrive:test --drive-use-created-date --min-age=5m 
        0 2021-11-15 15:28:33.865000000 file.txt

Thanks again @asdffdsa, now that you point that out I did see that in the manual but for some unkown reason I didn't try it. Probably busy trying a few other things amongst being distracted and forgot it. Its working nicely, thanks
Cheers

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