Delete old versions from OneDrive by date instead of version number

What is the problem you are having with rclone?

I am trying to delete other versions of my files on OneDrive but oddly, version 1.0 is the latest and version 2.0 is the older one. Hence, using cleanup tries to remove the latest version.

Example:

Versions saved for 20160709.mkv

No. Modified Modified By Size Comments
2.0 12/29/2022 3:39 PM Me 286.4 MB
1.0 12/30/2022 6:12 PM Me 286.4 MB

I want to keep the version from 12/30/2022 6:12 PM. Is there a way for rclone the remove older versions based from the date and time and not the version number?

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

rclone v1.61.1
- os/version: ubuntu 18.04 (64 bit)
- os/kernel: 5.10.147+ (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.19.4
- go/linking: static
- go/tags: none

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

OneDrive

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

rclone cleanup -i onedrive_sharepoint:"My Archive"

The rclone config contents with secrets removed.

[onedrive_sharepoint]
type = onedrive
client_id = [redacted]
client_secret = [redacted]
token = {"access_token":"redacted","token_type":"Bearer","refresh_token":"redacted","expiry":"2022-12-01T16:27:37.932408935Z"}
drive_id = [redacted]
drive_type = business

A log from the command with the -vv flag

2023/01/07 18:54:49 DEBUG : rclone: Version "v1.61.1" starting with parameters ["rclone" "cleanup" "-vv" "-i" "onedrive_sharepoint:My Archive"]
2023/01/07 18:54:49 DEBUG : Creating backend with remote "onedrive_sharepoint:My Archive"
2023/01/07 18:54:49 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2023/01/07 18:54:49 DEBUG : onedrive_sharepoint: Loaded invalid token from config file - ignoring
2023/01/07 18:54:49 DEBUG : Saving config "token" in section "onedrive_sharepoint" of the config file
2023/01/07 18:54:49 DEBUG : onedrive_sharepoint: Saved new token in config file
rclone: clean up old files "OneDrive root 'My Archive'"?
y) Yes, this is OK (default)
n) No, skip this
s) Skip all clean up old files operations with no more questions
!) Do all clean up old files operations with no more questions
q) Exit rclone now.
y/n/s/!/q> y
rclone: delete version "1.0 of 20160709.mkv"?
y) Yes, this is OK (default)
n) No, skip this
s) Skip all delete version operations with no more questions
!) Do all delete version operations with no more questions
q) Exit rclone now.
y/n/s/!/q>

Hi

From what I understand, the version number is produced according to the date of modification. So it should be fine when the files is deleted on the version number as it follows the date of modification.

I'm confused, can you please clarify? If you check the log, rclone is trying to delete the latest version (12/30/2022 6:12 PM) instead of the older one (12/29/2022 3:39 PM).

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