Lsjson --stat doesn't show the name of the shared directory root for Google Drive

What is the problem you are having with rclone?

I am trying to automate downloading public directories from Google Drive, and I'm using rclone's root_folder_id= parameter to accomplish this.

Here's what I'd use for this directory I've made as an example:

rclone copy gdrive,root_folder_id=1T7zwCbnmFQC_uK1KPbUeYc__VqK77S5b: target_directory

However, I'd like for the downloads to be placed in a directory with the same name as the shared directory, rather than just target_directory. In the case of my example, this would be test_directory, as visible in the web UI:

Rclone always copies the contents, rather than the directory itself, as per the docs:

Note that it is always the contents of the directory that is synced, not the directory itself. So when source:path is a directory, it's the contents of source:path that are copied, not the directory name and contents.

So I have to script this to generate a command that would replace the target_directory with the name, in this case test_directory. The issue is, there's seemingly no way to get that name that's shown in the web UI via Rclone.

I've tried rclone lsjson --stat on the root, but the Name field there is empty:

$ rclone lsjson --stat gdrive,root_folder_id=1T7zwCbnmFQC_uK1KPbUeYc__VqK77S5b:
{
        "Path": "",
        "Name": "",
        "Size": -1,
        "MimeType": "inode/directory",
        "ModTime": "2024-12-22T17:49:05.934+01:00",
        "IsDir": true
}

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

rclone v1.68.2
- os/version: debian trixie/sid (64 bit)
- os/kernel: 6.11.9-amd64 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.23.3
- go/linking: static
- go/tags: none

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 lsjson --stat gdrive,root_folder_id=1T7zwCbnmFQC_uK1KPbUeYc__VqK77S5b:

The rclone config contents with secrets removed.

[gdrive]
type = drive
token = {"access_token":"REDACTED","token_type":"Bearer","refresh_token":"REDACTED","expiry":"2024-12-22T18:38:56.206333024+01:00"}
team_drive = 

A log from the command with the -vv flag

2024/12/22 17:51:47 DEBUG : rclone: Version "v1.68.2" starting with parameters ["/home/grzesiek11/pobrane/rclone-v1.68.2-linux-amd64/rclone" "lsjson" "--stat" "-vv" "gdrive,root_folder_id=1T7zwCbnmFQC_uK1KPbUeYc__VqK77S5b:"]
2024/12/22 17:51:47 DEBUG : Creating backend with remote "gdrive,root_folder_id=1T7zwCbnmFQC_uK1KPbUeYc__VqK77S5b:"
2024/12/22 17:51:47 DEBUG : Using config file from "/home/grzesiek11/.config/rclone/rclone.conf"
2024/12/22 17:51:47 DEBUG : gdrive: detected overridden config - adding "{Uqpor}" suffix to name
2024/12/22 17:51:47 DEBUG : fs cache: renaming cache item "gdrive,root_folder_id=1T7zwCbnmFQC_uK1KPbUeYc__VqK77S5b:" to be canonical "gdrive{Uqpor}:"
{
        "Path": "",
        "Name": "",
        "Size": -1,
        "MimeType": "inode/directory",
        "ModTime": "2024-12-22T17:51:47.697+01:00",
        "IsDir": true
}
2024/12/22 17:51:47 DEBUG : 6 go routines active

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