# Sync with a time delayed delete

**URL:** <https://forum.rclone.org/t/sync-with-a-time-delayed-delete/27460>\
**Category:** Help and Support\
**Created:** [November 12, 2021, 4:52am UTC](https://forum.rclone.org/t/sync-with-a-time-delayed-delete/27460 "2021-11-12T04:52:45Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChooksRule](https://forum.rclone.org/letter_avatar_proxy/v4/letter/c/a4c791/32.png) [@ChooksRule](https://forum.rclone.org/u/ChooksRule)\
**Post date:** [November 12, 2021, 4:52am UTC](https://forum.rclone.org/t/sync-with-a-time-delayed-delete/27460/1 "2021-11-12T04:52:45Z")

</div>

#### 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`)

````auto

#### 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":""}
````

---

<div class="post-metadata">

**Author:** ![Animosity022](https://forum.rclone.org/user_avatar/forum.rclone.org/animosity022/32/451_2.png) [@Animosity022](https://forum.rclone.org/u/Animosity022)\
**Post date:** [November 12, 2021, 12:33pm UTC](https://forum.rclone.org/t/sync-with-a-time-delayed-delete/27460/2 "2021-11-12T12:33:05Z")

</div>

You can use:

[https://rclone.org/docs/#backup-dir-dir](https://rclone.org/docs/#backup-dir-dir)

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

---

<div class="post-metadata">

**Author:** ![ChooksRule](https://forum.rclone.org/letter_avatar_proxy/v4/letter/c/a4c791/32.png) [@ChooksRule](https://forum.rclone.org/u/ChooksRule)\
**Post date:** [November 12, 2021, 12:51pm UTC](https://forum.rclone.org/t/sync-with-a-time-delayed-delete/27460/3 "2021-11-12T12:51:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![asdffdsa](https://forum.rclone.org/letter_avatar_proxy/v4/letter/a/848f3c/32.png) [@asdffdsa](https://forum.rclone.org/u/asdffdsa)\
**Post date:** [November 12, 2021, 1:16pm UTC](https://forum.rclone.org/t/sync-with-a-time-delayed-delete/27460/4 "2021-11-12T13:16:22Z")

</div>

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`

---

<div class="post-metadata">

**Author:** ![ChooksRule](https://forum.rclone.org/letter_avatar_proxy/v4/letter/c/a4c791/32.png) [@ChooksRule](https://forum.rclone.org/u/ChooksRule)\
**Post date:** [November 15, 2021, 3:14am UTC](https://forum.rclone.org/t/sync-with-a-time-delayed-delete/27460/5 "2021-11-15T03:14:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![asdffdsa](https://forum.rclone.org/letter_avatar_proxy/v4/letter/a/848f3c/32.png) [@asdffdsa](https://forum.rclone.org/u/asdffdsa)\
**Post date:** [November 15, 2021, 8:31pm UTC](https://forum.rclone.org/t/sync-with-a-time-delayed-delete/27460/6 "2021-11-15T20:31:42Z")

</div>

try [https://rclone.org/drive/#drive-use-created-date](https://rclone.org/drive/#drive-use-created-date)

```auto
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

```

---

<div class="post-metadata">

**Author:** ![ChooksRule](https://forum.rclone.org/letter_avatar_proxy/v4/letter/c/a4c791/32.png) [@ChooksRule](https://forum.rclone.org/u/ChooksRule)\
**Post date:** [November 15, 2021, 10:22pm UTC](https://forum.rclone.org/t/sync-with-a-time-delayed-delete/27460/7 "2021-11-15T22:22:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://forum.rclone.org/uploads/default/original/2X/3/39ad3235f6ffec76ccd0c81616bd55697b4c300d.png) [@system](https://forum.rclone.org/u/system)\
**Post date:** [December 15, 2021, 10:22pm UTC](https://forum.rclone.org/t/sync-with-a-time-delayed-delete/27460/8 "2021-12-15T22:22:50Z")

</div>

Closed on December 15, 2021, 10:22pm UTC

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