Rclone rc operations/list - listing file - error in ListJSON: directory not found

Hi,

With Rclone it's possible to list a file:

rclone ls gdrive:test.txt
73012 test.txt

I am trying to do the same using RC command, however when I run:

rclone rcd --rc-no-auth

rclone rc operations/list fs=gdrive: remote=test.txt

I get the:

{
	"error": "error in ListJSON: directory not found",
	"input": {
		"fs": "gdrive:",
		"remote": "test.txt"
	},
	"path": "operations/list",
	"status": 404
}
2025/02/03 14:14:40 NOTICE: Failed to rc: operation "operations/list" failed: error in ListJSON: directory not found

instead.

On the other hand: rclone rc operations/list fs=gdrive:test.txt remote= returns:

{
	"error": "is a file not a directory",
	"input": {
		"fs": "gdrive:test.txt",
		"remote": ""
	},
	"path": "operations/list",
	"status": 500
}
2025/02/03 14:23:04 NOTICE: Failed to rc: operation "operations/list" failed: is a file not a directory

Is it possible to query specific file (not directory contents) using RC?

In my use case, I upload a file, but I then try to obtain its ModTime exactly as returned in the listing, so I can be sure if file has changed or not by just looking on the listing values.
It seems that different back-ends offer different precisions in their listings response (e.g. Dropbox uses seconds, Google Drive milliseconds etc.), I am trying to match it exactly as its.

rclone --version

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

You could use filters and only include file you are looking for.

1 Like

Thanks for the hint, so this command actually worked fine:

rclone rc operations/list remote= fs=gdrive: _filter='{"IncludeRule":["test.txt"]}' opt='{"filesOnly":true}'

Nice. Ta for sharing your working example.