Sharepoint - delete files

What is the problem you are having with rclone?

I’m trying to make some autobackup scripts for some services, the scripts have a check to delete the older files (3 or 7 days older). Everything goes smoothly, but when i try to delete a file (‘‘‘rclone deletefile’’’) I got this error:

ERROR : Attempt 3/3 failed with 1 errors and: remote:path/file.ext is a directory or doesn't exist: object not found
NOTICE: Failed to deletefile: remote:path/file.ext is a directory or doesn't exist: object not found

I have a OneDrive remote configured, pointing to a SharePoint site, with a root_id_folder specified in the config.

I tried change to ‘‘‘rclone delete’’’, but then the error is:

ERROR : Attempt 3/3 failed with 2 errors and: found file when looking for folder
NOTICE: Failed to delete with 2 errors: last error was: found file when looking for folder

and I know, for sure, that the real file exists, it’s not a folder, and path is correct. I already redo the config with no luck. I tried the commands manually and through the script, same result.

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

rclone v1.71.1
- os/version: ubuntu 24.04 (64 bit)
- os/kernel: 6.8.0-85-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.25.1
- go/linking: static
- go/tags: none

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

Onedrive (SharePoint)

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

rclone deletefile sharepoint:path/to/file.ext
rclone delete sharepoint:path/to/file.ext

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

[sharepoint]
type = onedrive
client_id = XXX
client_secret = XXX
token = XXX
drive_id = XXX
drive_type = documentLibrary
root_folder_id = XXX

A log from the command that you were trying to run with the -vv flag

~# rclone delete sharepoint:"path/file.ext" -vv
2025/10/15 12:14:40 DEBUG : rclone: Version "v1.71.1" starting with parameters ["rclone" "delete" "sharepoint:path/file.ext" "-vv"]
2025/10/15 12:14:40 DEBUG : Creating backend with remote "sharepoint:path/file.ext"
2025/10/15 12:14:40 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2025/10/15 12:14:43 DEBUG : Waiting for deletions to finish
2025/10/15 12:14:43 ERROR : error listing: found file when looking for folder
2025/10/15 12:14:43 ERROR : Attempt 1/3 failed with 2 errors and: found file when looking for folder
2025/10/15 12:14:43 DEBUG : Waiting for deletions to finish
2025/10/15 12:14:43 ERROR : error listing: found file when looking for folder
2025/10/15 12:14:43 ERROR : Attempt 2/3 failed with 2 errors and: found file when looking for folder
2025/10/15 12:14:43 DEBUG : Waiting for deletions to finish
2025/10/15 12:14:43 ERROR : error listing: found file when looking for folder
2025/10/15 12:14:43 ERROR : Attempt 3/3 failed with 2 errors and: found file when looking for folder
2025/10/15 12:14:43 DEBUG : 6 go routines active
2025/10/15 12:14:43 NOTICE: Failed to delete with 2 errors: last error was: found file when looking for folder

~# rclone deletefile sharepoint:"path/file.ext" -vv
2025/10/15 12:14:52 DEBUG : rclone: Version "v1.71.1" starting with parameters ["rclone" "deletefile" "sharepoint:path/file.ext" "-vv"]
2025/10/15 12:14:52 DEBUG : Creating backend with remote "sharepoint:path/file.ext"
2025/10/15 12:14:52 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2025/10/15 12:14:55 ERROR : Attempt 1/3 failed with 1 errors and: sharepoint:path/file.ext is a directory or doesn't exist: object not found
2025/10/15 12:14:55 ERROR : Attempt 2/3 failed with 1 errors and: sharepoint:path/file.ext is a directory or doesn't exist: object not found
2025/10/15 12:14:55 ERROR : Attempt 3/3 failed with 1 errors and: sharepoint:path/file.ext is a directory or doesn't exist: object not found
2025/10/15 12:14:55 DEBUG : 6 go routines active
2025/10/15 12:14:55 NOTICE: Failed to deletefile: sharepoint:path/file.ext is a directory or doesn't exist: object not found

welcome to the forum,

sorry, but a bit confusing with all these different paths and remote names??
path/to/file.ext, path/file.ext, remote:path/file.ext, sharepoint:path/to/file.ext


please post the output of rclone ls -vv to show that the file file.ext exists.


have you tested without that?


might test rclone delete sharepoint:path --include="file.ext " -vv


fwiw, to keep the logs small, use --retries=1

Yes, that are all the same, sorry. I just use a generic name for the path and file, but the remote name is ‘sharepoint’.

I tested, it did work, but I really want to close the scope which rclone will work to my “Backups” folder. There’s something I can do?

sure, use an alias remote. something like

[Backups]
type = alias
remote = sharepoint:path/to/directory

fwiw, a good way to see how the root_folder_id affects the scope is rclone tree
rclone tree Backups:
rclone ls Backups:

It really weird that the command doesn’t take the path as relative and add it to the path of root_id. Well, thank you, I think I will go with your suggestion, because troubleshooting this is already driving me crazy.

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