How to access mounted online accounts from filesystem?
I added my Google Drive to Online Accounts as described in How to Access your Google Drive Account in Ubuntu 18.04 LTS.
It works fine from the graphic interface:
But how do I access it through the file-system from the command line?
UPDATE: I've found this:
$ mount | grep gv
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
$ cd /run/user/1000/gvfs/google-drive:host=gmail.com,user=butterworth.ray
$ ls -lgAFt
ls: cannot read symbolic link '1PhljWusfB-JWfKSu3xqzSzCOqztgDTEDWqfG3E2KioQ': Function not implemented
ls: cannot read symbolic link '12TmyqxUuLFQIktoec0Pe2ygDVPVx9YsDfi6tS2hAXFc': Function not implemented
ls: cannot read symbolic link '1uUnjOG172XdBQ1fLe6AbslNjsHiTK-IaUpzImwkwSbc': Function not implemented
...
total 0
lrw------- 1 ray 0 Jan 19 15:56 1IkBP3RVzCkMPO8UYI8LFyLo71rCOhbEirSMuS39GxUc
lrw------- 1 ray 0 Jan 5 10:06 1JkZJuIN4U-XwOLfKmYr3-0Y2KYQMQ_EmVrZPj1i1AMI
lrw------- 1 ray 0 Jun 15 2018 12TmyqxUuLFQIktoec0Pe2ygDVPVx9YsDfi6tS2hAXFc
drwx------ 1 ray 0 Jun 15 2018 1E3zpESlcc90ZmhjztC4HD22chifWHUkk/
lrw------- 1 ray 0 Jun 15 2018 1uUnjOG172XdBQ1fLe6AbslNjsHiTK-IaUpzImwkwSbc
lrw------- 1 ray 0 Jun 15 2018 1PhljWusfB-JWfKSu3xqzSzCOqztgDTEDWqfG3E2KioQ
...
The entries correspond to the Google-Drive data,but the file-system sees them all as bad symlinks, except for the sub-directory, which in turn contains bad symlinks.
UPDATE 2:
Perhaps I need to create an /etc/fstab entry? If so, what would be suitable?
Solution 1:
In reference to when you got this output from ls
:
lrw------- 1 ray 0 Jan 19 15:56 1IkBP3RVzCkMPO8UYI8LFyLo71rCOhbEirSMuS39GxUc
lrw------- 1 ray 0 Jan 5 10:06 1JkZJuIN4U-XwOLfKmYr3-0Y2KYQMQ_EmVrZPj1i1AMI
lrw------- 1 ray 0 Jun 15 2018 12TmyqxUuLFQIktoec0Pe2ygDVPVx9YsDfi6tS2hAXFc
drwx------ 1 ray 0 Jun 15 2018 1E3zpESlcc90ZmhjztC4HD22chifWHUkk/
lrw------- 1 ray 0 Jun 15 2018 1uUnjOG172XdBQ1fLe6AbslNjsHiTK-IaUpzImwkwSbc
lrw------- 1 ray 0 Jun 15 2018 1PhljWusfB-JWfKSu3xqzSzCOqztgDTEDWqfG3E2KioQ
Those are actually the names of the google drive files and directories themselves and is how google manages data (useful in versioning files and having multiple files with the same name). The human readable names are just bits of metadata attached to each file. Once you're in your google drive directory you can use the gio
interface to view those human readable file names with this:
gio list -d
That prints what gnome calls the display names
of each file.
Just man gio
for other gio list
options like --long
, --hidden
, etc.
In that man page you'll also see other gio commands for manipulating your cloud files from a terminal. Unfortunately I have yet to find or figure out a good approach to wrapping the standard shell commands around the gio commands for a more seamless experience (like the way Google Drive File Stream
just works when accessing files from a terminal on Windows or macOS). I'll update this answer if I find a good solution.
That said, this is all an attempt to just use the Gnome's integrated cloud drive interface because it is dead simple to set up and seems to preform well in the Nautilus GUI. But there are alternatives such as rclone and ocamlfuse which both work pretty well but can be difficult to configure especially in terms of maximizing speed.
Solution 2:
Hmmm, I see what you mean.
You can get some more info out like this:
First, find the base URL for your google drive like this:
BASE_URL=`gio mount -li | egrep '^Mount.*google-drive' | sed 's/.*> //'`
Mine is like: google-drive://[email protected]/
.
Then you can use gio
again to list properties like this:
$ gio list -a 'standard::display-name' "$BASE_URL"
1t1221oLkvviV7UXqBjXmWKipT_w 0 (shortcut) standard::display-name=Swifty14
1h332234_ZoCetVVCpwbdzoeh1_Y 0 (shortcut) standard::display-name=Holls 2016
I mean it's still not nice, but it gets you somewhere! This cleans it up a bit:
$ gio list -a 'standard::display-name' "$BASE_URL" | awk '{print $1 "\t" $4}' | sed 's/standard::display-name=//'
1t1221oLkvviV7UXqBjXmWKipT_w Swifty14
1h332234_ZoCetVVCpwbdzoeh1_Y Holls 2016