Jump to content

Google Drive — List File Stream contents from Google Drive


Recommended Posts

Hi @vitor I'm not seeing results for all accounts. I have 3 google drives attached and only see results for the first of 3.

 

Maybe I'm configuring it wrong?

 

Help thanks!

 

### Workflow version
2022.20

### Alfred version
5.0.2

### macOS version
12.5.1

### Architecture
i386

### Preferences
Default

### Full Disk Access
Granted

### Google drive path
Does NOT Exist: /Volumes/GoogleDrive, /Volumes/GoogleDrive-106588684568380285670, /Volumes/GoogleDrive-111289155870008731233

### Cache dir
cache.db
tmp.db

### Cache file
16777220 4458622432 -rw-r--r-- 1 jaime staff 0 471040 "Sep 20 12:48:24 2022" "Sep 20 12:46:56 2022" "Sep 20 12:46:56 2022" "Sep 20 12:46:36 2022" 4096 1024 0 /Users/jaime/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/com.alfredapp.googledrive/cache.db

### Temporary cache
16777220 4458626248 -rw-r--r-- 1 jaime staff 0 18034688 "Sep 20 13:05:41 2022" "Sep 20 13:05:41 2022" "Sep 20 13:05:41 2022" "Sep 20 12:54:02 2022" 4096 36992 0 /Users/jaime/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/com.alfredapp.googledrive/tmp.db

### Build progress
Running

### Launchd job
Loaded: -    0    com.alfredapp.googledrive
Installed
 

Link to comment
6 minutes ago, jgacitua said:

### Google drive path
Does NOT Exist: /Volumes/GoogleDrive, /Volumes/GoogleDrive-106588684568380285670, /Volumes/GoogleDrive-111289155870008731233

 

Google has probably changed the location of your drives; they’ve been doing that. Correct them and run :gdrebuildcache. Update to the latest version first, as it has a relevant change.

Link to comment
3 hours ago, vitor said:

 

Google has probably changed the location of your drives; they’ve been doing that. Correct them and run :gdrebuildcache. Update to the latest version first, as it has a relevant change.

 

Thanks Vitor!! I upgraded and it seems to be working again!

 

I have a further question, how can I include the contents behind the links or aliases in the search?

 

image.thumb.png.c5cd68a0aac9717829f1f16a6a18b8e4.png

 

I added the path of the first Alias following the instructions to find the path.

/Volumes/GoogleDrive-106588684568380285670/.shortcut-targets-by-id/1CZFQUFtLhk0_vCq2urLS3FL6TsqV-N1y/Legalbot 

 

I also did the rebuild cache.

 

But that folder still does not appear in the search results.... maybe something is wrong

 

### Workflow version
2022.20

### Alfred version
5.0.2

### macOS version
12.5.1

### Architecture
i386

### Preferences
Default

### Full Disk Access
Granted

### Google drive path
Does NOT Exist: /Volumes/GoogleDrive, /Volumes/GoogleDrive-106588684568380285670, /Volumes/GoogleDrive-111289155870008731233, /Volumes/GoogleDrive-106588684568380285670/.shortcut-targets-by-id/1CZFQUFtLhk0_vCq2urLS3FL6TsqV-N1y/Legalbot

### Cache dir
cache.db

### Cache file
16777220 4458853166 -rw-r--r-- 1 jaime staff 0 50896896 "Sep 20 17:06:20 2022" "Sep 20 14:15:32 2022" "Sep 20 14:15:32 2022" "Sep 20 13:55:25 2022" 4096 100480 0 /Users/jaime/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/com.alfredapp.googledrive/cache.db

### Temporary cache
Does NOT exist

### Build progress
NOT running

### Launchd job
Loaded: -    0    com.alfredapp.googledrive
Installed
 

 

 

Link to comment

Hi guys, 

 

Just bought the Workflows pack hoping I could use Alfred to search my Google Drive - but alas, tis not working.
I've double checked the drive path is correct - but still getting the error "Google Drive path does not exist"
any help would be amazing!!

 

thanks in advance!

 

- - - - -

 

### Workflow version
2022.21

### Alfred version
5.0.2

### macOS version
12.5

### Architecture
arm64

### Preferences
Default

### Full Disk Access
Granted

### Google drive path
Does NOT Exist: /Volumes/Google Drive/

### Cache dir
Files NOT present

### Cache file
Does NOT exist

### Temporary cache
Does NOT exist

### Build progress
NOT running

### Launchd job
Loaded: -    0    com.alfredapp.googledrive
Installed
 

Link to comment

First, THANK YOU for an awesome workflow. The latest Google Drive update (replacing some folders with shortcuts) has prevented Spotlight from indexing the 99% of my files that are inside a folder owned by another member of my Google Workspace org. This works! You've saved my workflow.

 

Second, I'm confused about which filepath to use for my Google Drive folder. When I open my Drive folder in Finder and then "right-click + option" to save the pathname, I get the first pathname below. But then when I try to go "up" the filepath, and then save the pathname again, it shows up as something very different:

 

/Users/calebdelon/My Drive (caleb@paperbackexpert.com)/

 

/Users/calebdelon/Library/CloudStorage/GoogleDrive-caleb@paperbackexpert.com/.shortcut-targets-by-id/0B34ddi827qW8TDYzVUN1OHZ3U2s/**Paperback Expert

 

Loom video showing this: https://www.loom.com/share/455362135db8405bae4095a44df974f8

 

Yet another option: When I go to Google Drive preferences, it shows this as the Google Drive Streaming Location:

 

/Users/calebdelon/Library/CloudStorage/GoogleDrive-caleb@paperbackexpert.com

 

So should I put that info the customized variable for google_drive_path? Or maybe this version:

 

/Users/calebdelon/Library/CloudStorage

 

???

 

I'm moderately tech-saavy, such that I can follow directions when it gets to this point, but I don't really understand what's going on. :P

 

Thanks for any help!

 

 

Screen Shot 2022-09-22 at 6.24.42 PM.png

Edited by Eirene
typo
Link to comment

Hi @vitor

Many thanks for this workflow... that saves mine!

 

I have a weird behavior I'd like your input on:

 

If I open a folder that Alfred suggests:

 

1. the path shown in the search box now includes /.Encrypted/ or /.shortcut-targets-by-id/jibberish, instead of the "normal" names of files. Not that a big deal, but sometimes I like reading this to be sure I'm opening the right file.

2. both folders suggested are actually the same, but if I open the first one, it has none of the files in it, only folders that may exist.

1513538577_Capturedecran2022-09-26a15_34_43.thumb.png.04aec4798f7def1f1b9614ea19fb2e2b.pngThe second folder has well everything in it. 

That's my second screenshot, with the bottom window being the folder opened through Alfred, the top one opened manually by me through the Finder.

Is that a cache thing maybe?

 

### Workflow version
2022.12

### Alfred version
4.7

### macOS version
12.5.1

### Architecture
i386

### Workflow environment variables
Dict {
    ignore_list = 
    result_limit = 50
    auto_refresh = 1
    google_drive_path = /Volumes/GoogleDrive
}

### Full Disk Access
Granted

### Google drive paths
Exists: /Volumes/GoogleDrive
98908 paths

### Cache dir
cache.db

### Cache file
16777220 133863107 -rw-r--r-- 1 emal staff 0 22163456 "Sep 26 15:28:59 2022" "Sep 26 14:37:24 2022" "Sep 26 14:37:24 2022" "Sep 26 14:30:24 2022" 4096 45184 0 /Users/emal/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/com.alfredapp.googledrive/cache.db

### Temporary cache
Does NOT exist

### Build progress
NOT running

### Launchd job
Loaded: -    0    com.alfredapp.googledrive
Installed
 

Many thanks

Capture d’écran 2022-09-26 à 15.41.19.png

Link to comment
23 minutes ago, Emal said:

the path shown in the search box now includes /.Encrypted/ or /.shortcut-targets-by-id/jibberish, instead of the "normal" names of files.


That’s how Google Drive does it now, those are the true paths of the files.

 

24 minutes ago, Emal said:

both folders suggested are actually the same, but if I open the first one, it has none of the files in it, only folders that may exist.


Add .Encrypted to the ignore list.

Link to comment
  • 3 weeks later...

Updated to 2022.22.

  • Use File Picker for choosing Google Drive folder. Because it is now an editable field, adding multiple comma-separated drive locations is still possible.
  • Add Configurable Keywords.
Edited by vitor
Link to comment

Thought I'll post an update here. Almost a year later, the File Provider API version (https://support.google.com/drive/answer/12178485?hl=en) rolled out to my machine. And I can confirm that standard Spotlight (and thus Alfred) search works again.

 

I believe Vitor's plugin is still a viable and more feature-packed alternative, but now a built-in alternative exists. At least for those who got the update from Google.

Link to comment
  • 3 weeks later...
On 10/14/2022 at 2:16 PM, mishamsk said:

Thought I'll post an update here. Almost a year later, the File Provider API version (https://support.google.com/drive/answer/12178485?hl=en) rolled out to my machine. And I can confirm that standard Spotlight (and thus Alfred) search works again.

 

I believe Vitor's plugin is still a viable and more feature-packed alternative, but now a built-in alternative exists. At least for those who got the update from Google.

 

@mishamsk Do you find that this works fully? It is working for me but only partly. It doesn't seem to find some files and folders. I can't tell if there's any pattern to those it can find. 

Link to comment
On 11/2/2022 at 6:58 AM, christoph282 said:

 

@mishamsk Do you find that this works fully? It is working for me but only partly. It doesn't seem to find some files and folders. I can't tell if there's any pattern to those it can find. 

@christoph282 I didn't do any specific testing, but so far haven't noticed that something is missing, have been able to find what I am looking for every time

Link to comment

@vitor Thanks so much for creating and maintaining this awesome workflow. My hotkey for this is now firmly engrained in my muscle memory, and I use it dozens of times a day.

 

Everything was working swimmingly for me, but with the upgrade to macOS Ventura I am now seeing repeated notifications for a background script, which seems to be related to this workflow (see attached). This especially happens any time my computer sleeps—when I wake it back up, I have several background script notifications. Have you seen that with this workflow before?

 

### Workflow version
2022.12

### Alfred version
4.7

### macOS version
13.0

### Architecture
i386

### Workflow environment variables
Dict {
    auto_refresh = 1
    google_drive_path = /Volumes/GoogleDrive/My Drive, /Volumes/GoogleDrive/Shared Drives/Voss Fixtures Team
    result_limit = 50
    ignore_list = 
}

### Full Disk Access
Granted

### Google drive paths
Exists: /Volumes/GoogleDrive/My Drive
6032 paths
Exists: /Volumes/GoogleDrive/Shared Drives/Voss Fixtures Team
48546 paths

### Cache dir
cache.db

### Cache file
16777220 123536149 -rw-r--r-- 1 benwhiting staff 0 10063872 "Nov  7 10:59:03 2022" "Nov  7 10:49:17 2022" "Nov  7 10:49:17 2022" "Nov  7 10:45:05 2022" 4096 20488 0 /Users/benwhiting/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/com.alfredapp.googledrive/cache.db

### Temporary cache
Does NOT exist

### Build progress
NOT running

### Launchd job
Loaded: -    0    com.alfredapp.googledrive
NOT installed
 

Notification Center 2022-11-07 16-50-54.jpg

Link to comment

Welcome @benwhiting,

 

It’s weird that you‘re seeing multiple notifications, that looks like a bug in macOS’ new system. This is the first report I’ve seen of such a thing. Have you tried rebooting? If you change the auto_refresh Workflow Environment Variable to 0 then run :gdrebuildcache, the auto-cache rebuilding will be removed so you shouldn’t get the notification either. However, that means having to manually run :gdrebuildcache every time you want to update the file list.

Link to comment
1 hour ago, benwhiting said:

When does the auto-cache normally run?

 

On boot and at 8PM. If the Mac is asleep at 8PM, it will run when it wakes up. But if it’s turned off it wouldn’t run, which is why it also runs at boot. The sleep behaviour is not behaviour I have control over, it’s how launchd works.

 

1 hour ago, benwhiting said:

When I run it manually

 

You mean when you run :gdrebuildcache?

 

1 hour ago, benwhiting said:

it doesn't like something about that script and may be interfering with the process.

 

The code is open, you can see and audit everything in the workflow. Two things are done when rebuilding the cache:

  1. Depending on your auto_refresh value it’ll either add or remove the launchd job (for rebuilding the cache periodically).
  2. The contents of your Google Drive are listed and added to a SQLite database (path is listed in your diagnostic), for fast retrieval when you use gd.

As explained above, it’s easy to disable the first part. In Alfred 5 it’s even simpler, as Workflow Configuration allows that to be a literal checkbox. As for the second part, that’s the point of the workflow. I did try solutions without building a cache, but a lot of people have an immense amount of files in Google Drive, such that any other method is incredibly slow. If you have software which is blocking that, you have to whitelist/fix it there.


You may also try to force Google Drive to update to the File Provider version (unsure if that’s possible, Google is moving people gradually) and see if it works for you without the workflow. If it doesn‘t work at first, try resetting your scope to something else. No guarantees that’ll work, though, Google’s Spotlight integration is still flaky: works for some but not others. I’d be interested to know your results either way.


Also, make sure you’re on Alfred 4.8 or version 5.

 

Edited by vitor
Link to comment

If you don’t see the file in the folder and you’ve already rebooted, the only explanation is that it is not the launch agent from this workflow causing the notification. You should at most have gotten one notification once; whatever is causing those three warnings is not this.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...