Google Drive reports file size -1 and an empty file when mounted

What is the problem you are having with rclone?

I have set up rclone to mount a GoogleDrive under ubuntu 20.04.3. Most things work as expected. However, google docs files are shown as docx, xlsx with a file size of -1 and empty content.

$ rclone lsl GoogleDrive:
     2154 ListeDavid.csv
       -1 Untitled spreadsheet.xlsx
$ rclone size GoogleDrive:ListeDavid.csv
Total objects: 1 (1)
Total size: 2.104 KiB (2154 Byte)
$ rclone size GoogleDrive:"Untitled spreadsheet.xlsx"
Total objects: 1 (1)
Total size: 0 B (0 Byte)
$ rclone mount GoogleDrive: GoogleDrive/ &
[1] 19097
$ ls -l GoogleDrive/
insgesamt 1
-rw-rw-r-- 1 jarrn jarrn 2154 Okt 28  2019  ListeDavid.csv
-rw-rw-r-- 1 jarrn jarrn    0 Jul 25  2019 'Untitled spreadsheet.xlsx'
$ rclone copy GoogleDrive:"Untitled spreadsheet.xlsx" .
$ ls -l Untitled\ spreadsheet.xlsx 
-rw-rw-r-- 1 user user 4347 Jul 25  2019 'Untitled spreadsheet.xlsx'

As you see, the file size is off for the google docs file "Untitled spreadsheet" but correct for the csv-file I uploaded earlier. The same applies to the mounted file system. However, downloading produces the correct file, correctly converted into xlsx.

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

$ rclone version
rclone v1.57.0
- os/version: ubuntu 20.04 (64 bit)
- os/kernel: 5.4.0-92-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.17.2
- go/linking: static
- go/tags: none

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

Google Drive, I use my own token if that matters.

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

rclone ls GoogleDrive:
rclone mount GoogleDrive: GoogleDrive/

The rclone config contents with secrets removed.

[GoogleDrive]
type = drive
client_id = SECRET
client_secret = SECRET
scope = drive
token = {"access_token":"SECRET","token_type":"Bearer","refresh_token":"SECRET","expiry":"2022-01-10T15:06:28.361342408+01:00"}
root_folder_id = SECRET

A log from the command with the -vv flag

Please note that I skipped some files earlier. The mounted directory contains 15 files and 1 folder in total.

$ rclone ls GoogleDrive: -vv
2022/01/10 14:18:28 DEBUG : rclone: Version "v1.57.0" starting with parameters ["rclone" "ls" "GoogleDrive:" "-vv"]
2022/01/10 14:18:28 DEBUG : Creating backend with remote "GoogleDrive:"
2022/01/10 14:18:28 DEBUG : Using config file from "/home/jarrn/.config/rclone/rclone.conf"
     2154 ListeDavid.csv
       -1 Untitled spreadsheet.xlsx
2022/01/10 14:18:29 DEBUG : 6 go routines active

$ rclone mount GoogleDrive: GoogleDrive/ -vv
2022/01/10 14:20:12 DEBUG : rclone: Version "v1.57.0" starting with parameters ["rclone" "mount" "GoogleDrive:" "GoogleDrive/" "-vv"]
2022/01/10 14:20:12 DEBUG : Creating backend with remote "GoogleDrive:"
2022/01/10 14:20:12 DEBUG : Using config file from "/home/user/.config/rclone/rclone.conf"
2022/01/10 14:20:12 DEBUG : Google drive root '': Mounting on "GoogleDrive/"
2022/01/10 14:20:12 DEBUG : : Root: 
2022/01/10 14:20:12 DEBUG : : >Root: node=/, err=<nil>
2022/01/10 14:20:12 DEBUG : /: Lookup: name=".Trash"
2022/01/10 14:20:13 DEBUG : /: >Lookup: node=<nil>, err=no such file or directory
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Lookup: name=".xdg-volume-info"
2022/01/10 14:20:13 DEBUG : /: >Lookup: node=<nil>, err=no such file or directory
2022/01/10 14:20:13 DEBUG : /: Lookup: name="autorun.inf"
2022/01/10 14:20:13 DEBUG : /: >Lookup: node=<nil>, err=no such file or directory
2022/01/10 14:20:13 DEBUG : /: Lookup: name=".Trash-1000"
2022/01/10 14:20:13 DEBUG : /: >Lookup: node=<nil>, err=no such file or directory
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Attr: 
2022/01/10 14:20:13 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2022/01/10 14:20:13 DEBUG : /: ReadDirAll: 
2022/01/10 14:20:13 DEBUG : /: >ReadDirAll: item=17, err=<nil>
2022/01/10 14:20:13 DEBUG : /: Lookup: name="autorun.inf"
2022/01/10 14:20:13 DEBUG : /: >Lookup: node=<nil>, err=no such file or directory
^C2022/01/10 14:21:12 INFO  : Signal received: interrupt
2022/01/10 14:21:12 ERROR : GoogleDrive/: Unmounted rclone mount
2022/01/10 14:21:12 INFO  : Exiting...

hello and welcome to the forum

that is documented here
"Google docs will appear as size -1 in rclone ls and as size 0 in anything which uses the VFS layer, e.g. rclone mount, rclone serve."

that is documented here
"When rclone downloads a Google doc it chooses a format to download depending upon the --drive-export-formats setting. By default the export formats are docx,xlsx,pptx,svg which are a sensible default for an editable document."

So what you are saying is that mounting the file system and trying to open converted google doc files this way is essentially useless to me as the file size is 0 and any application I use will just open an empty file?

What I would expect reading the documentary is that the file size is reported as "0" but when I mount the drive and open one of the converted files I nevertheless get the actual content.

Did I miss anything?

Sorry for pestering you again. I found a workaround to my problem:

When I open the file directly with

$ xdg-open File.xlsx

I get an empty file.

However, if I first cat the file's contents (which is garbage in case of an xlsx file, I can then open the file normally:

$ cat File.xlsx
[garbage]
$ xdg-open File.xlsx

However, I can do that from the command line, but I would still like to use some GUI which will not cat the file first. Any workaround for that?

i shared the doc links, did you read them?
if something specific was not clear, let me know.

What I was indeed missing was the following statement (here):

However an unfortunate consequence of this is that you may not be able to download Google docs using rclone mount . If it doesn't work you will get a 0 sized file. If you try again the doc may gain its correct size and be downloadable. Whether it will work on not depends on the application accessing the mount and the OS you are running - experiment to find out if it does work for you!

Which is -- unfortunate.

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