Rclone delete and Rclone rmdirs throw errors if path not found

What is the problem you are having with rclone?

rclone delete "path" and rclone rmdirs "path" generate ERRORS if "path" does not exist

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

rclone v1.61.1
- os/version: Microsoft Windows 10 Pro 21H2 (64 bit)
- os/kernel: 10.0.19044.2364 (x86_64)
- os/type: windows
- os/arch: amd64
- go/version: go1.19.4
- go/linking: static
- go/tags: cmount

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

MS OneDrive Personal

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

rclone delete od:Backups\DataVer\%deldate%
rclone rmdirs od:Backups\DataVer\%deldate%

The rclone config contents with secrets removed.

[od]
type = onedrive
token = 
drive_id = 
drive_type = personal

A log from the command with the -vv flag

C:\rclone>rclone delete od:Backups\DataVer\2022-12-30 -vv
2022/12/30 23:09:06 DEBUG : rclone: Version "v1.61.1" starting with parameters ["rclone" "delete" "od:Backups\\DataVer\\2022-12-30" "-vv"]
2022/12/30 23:09:06 DEBUG : Creating backend with remote "od:Backups\\DataVer\\2022-12-30"
2022/12/30 23:09:06 DEBUG : Using config file from "C:\\Users\\Ashim Jain\\AppData\\Roaming\\rclone\\rclone.conf"
2022/12/30 23:09:07 DEBUG : fs cache: renaming cache item "od:Backups\\DataVer\\2022-12-30" to be canonical "od:Backups/DataVer/2022-12-30"
2022/12/30 23:09:07 DEBUG : Waiting for deletions to finish
2022/12/30 23:09:08 ERROR : : error listing: directory not found
2022/12/30 23:09:08 ERROR : Attempt 1/3 failed with 2 errors and: directory not found
2022/12/30 23:09:08 DEBUG : Waiting for deletions to finish
2022/12/30 23:09:08 ERROR : : error listing: directory not found
2022/12/30 23:09:08 ERROR : Attempt 2/3 failed with 2 errors and: directory not found
2022/12/30 23:09:08 DEBUG : Waiting for deletions to finish
2022/12/30 23:09:08 ERROR : : error listing: directory not found
2022/12/30 23:09:08 ERROR : Attempt 3/3 failed with 2 errors and: directory not found
2022/12/30 23:09:08 DEBUG : 3 go routines active
2022/12/30 23:09:08 Failed to delete with 2 errors: last error was: directory not found

C:\rclone>rclone rmdirs od:Backups\DataVer\2022-12-30 -vv
2022/12/30 23:09:08 DEBUG : rclone: Version "v1.61.1" starting with parameters ["rclone" "rmdirs" "od:Backups\\DataVer\\2022-12-30" "-vv"]
2022/12/30 23:09:08 DEBUG : Creating backend with remote "od:Backups\\DataVer\\2022-12-30"
2022/12/30 23:09:08 DEBUG : Using config file from "C:\\Users\\Ashim Jain\\AppData\\Roaming\\rclone\\rclone.conf"
2022/12/30 23:09:10 DEBUG : fs cache: renaming cache item "od:Backups\\DataVer\\2022-12-30" to be canonical "od:Backups/DataVer/2022-12-30"
2022/12/30 23:09:10 ERROR : OneDrive root 'Backups/DataVer/2022-12-30': Failed to list "": directory not found
2022/12/30 23:09:10 INFO  : OneDrive root 'Backups/DataVer/2022-12-30': Removing directory
2022/12/30 23:09:11 ERROR : : Failed to rmdir: directory not found
2022/12/30 23:09:11 ERROR : Attempt 1/3 failed with 2 errors and: directory not found
2022/12/30 23:09:11 ERROR : OneDrive root 'Backups/DataVer/2022-12-30': Failed to list "": directory not found
2022/12/30 23:09:11 INFO  : OneDrive root 'Backups/DataVer/2022-12-30': Removing directory
2022/12/30 23:09:13 ERROR : : Failed to rmdir: directory not found
2022/12/30 23:09:13 ERROR : Attempt 2/3 failed with 2 errors and: directory not found
2022/12/30 23:09:13 ERROR : OneDrive root 'Backups/DataVer/2022-12-30': Failed to list "": directory not found
2022/12/30 23:09:13 INFO  : OneDrive root 'Backups/DataVer/2022-12-30': Removing directory
2022/12/30 23:09:13 ERROR : : Failed to rmdir: directory not found
2022/12/30 23:09:13 ERROR : Attempt 3/3 failed with 2 errors and: directory not found
2022/12/30 23:09:13 DEBUG : 3 go routines active
2022/12/30 23:09:13 Failed to rmdirs with 2 errors: last error was: directory not found

I also tried using the flag:

--ignore-errors

but it didn't help. Besides, I would like it not to ignore all errors but only the one of not finding the directory. Thank you volunteers in advance for your help.

Check the exit code of rclone - I think that should help.

Thank you for your response Nick.

I have read the entire Exit Code section but having to process various exit codes in a batch file is a lengthy process that I would like to stay away from.

IN SHORT:

Is there a way to tell rclone delete and reclone rmdirs to ignore only errors related to path not found or directory does not exist? Is there some global flag, environment variable, etc. that would do the trick?

MY TASK:
I am running a batch file to do automatic versioning backup that does a full backup of complete drives and also retains "x" number of versions of all the changed files in their respective folder structures, so I have to delete versioned files outside "x" and remove empty directories which could be in hundreds or thousands.

Thank you again for your time and help.

No tricks I'm afraid! I would have though ignoring the relevant 2 exit codes would be easy enough?

Or use rclone lsjon --stat to see whether the path exists first

Thank you Nick for pointing out that it was only 2 exit codes to ignore -- it was my bad that I didn't realize this. Problem solved.

Often, we users and the public in general don't fully realize and appreciate the selfless work you and other volunteers do in return for nothing. Hats off to your dedication which is not even found in paid positions these days.

1 Like

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