Jump to content

Google Drive — List File Stream contents from Google Drive


Recommended Posts

An interim Workflow to bridge the gap until (if) Google Drives fixes the situation of files not being indexable by Spotlight (and thus Alfred).


Before your first use, run :gdlaunchd and wait for the notification. The more files you have, the longer the wait. It can take several minutes to finish building the cache. A macOS launchd agent will be loaded to do it daily (running :gdlaunchd again removes it).


To rebuild the cache on demand, do :gdrebuildcache.


When done, call gd and type to filter the contents of your Google Drive.


The Workflow Environment Variables have defaults which will work for most. You only have to mess with them if you have an atypical setup.

  • google_drive_path: The location of Google Drive on your file system. Can take multiple paths separated by commas.
  • ignore_list: A comma-separated list of keywords to ignore. If any appears in a path, it will not be saved to your cache.
  • result_limit: How many entries to show in Alfred.

 

Download | Source

Edited by vitor
Link to comment

Tips

  • Before asking for help, open the debugger, set the log output to “All Information”, and perform the failing action. Post the output.
  • When asking for help, be sure to include the versions of your installations of:
    • The Workflow.
    • Alfred.
    • macOS.
  • If your Google Drive is in an atypical location, use Alfred to copy its path.
  • If you don’t know how to change the Workflow Environment Variables, consult the instructions.
Edited by vitor
Link to comment
6 minutes ago, Appu Mohan said:

How to make it work for multiple accounts ?

 

On 9/9/2021 at 6:16 PM, vitor said:

The Workflow Environment Variables have defaults which will work for most people. You will only have to mess with them if you have an atypical setup.

  • google_drive_path: The location of Google Drive on your file system. Can take multiple paths separated by commas.

 

Link to comment
  • 2 weeks later...

Hi!

 

Many MANY thanks @vitor for offering such a workaround. This new Google Drive thing skipping such a central feature in my workflow sure pissed me off. I waited for the last moment praying this would be fixed but now I'm forced, I see that no 😕

So you just made me buy the powerpack just to use your workflow!  😅 (was already an Alfred user, but a free one).

As someone discovering the powerpack and first time workflow user, I was wondering initially where did I had to run the  ":gdrebuildcache or :gdlaunchd" commands, I tried in the Terminal at first.

 

But I'm not sure which one to choose as you're saying "or".

 

I did both and restarted my laptop, but it doesn't seem to work.

I only have one G Drive account.

Any clue on how to troubleshoot this?

 

Thanks!

1521276011_Capturedecran2021-10-01a13_48_29.thumb.png.55a37ba08cbd5352bf26c5e9ed8e235c.png

Link to comment
1 minute ago, Emal said:

I was wondering initially where did I had to run the  ":gdrebuildcache or :gdlaunchd" commands, I tried in the Terminal at first.

 

You run them in Alfred. In doubt, run the second. It will probably take a while to finish.

 

Welcome to the forums.

Link to comment

Thanks :)

Yeah I ended up figure this out, I also ran them both but how do I know it's been done properly?  

Oh, I see "A notification will be shown when done", I indeed never saw one. So I let it work in the background, but by "a while" you're thinking mere minutes or maybe 30 or 90?

Capture d’écran 2021-10-01 à 14.03.13.png

Link to comment

Hi,

 

It's been 3 hours now, is this supposed to be a possibility or something is wrong here?

115GB of files to be indexed.

I can wait a full night if needed, but I feel like nothing happens, and I have no way of knowing it. @vitor

 

Link to comment

Run :gdlaunchd to disable it. If it’s already disabled, don’t do it. Restart your Mac. Open the debugger, set the log output to “All Information”, and run :gdrebuildcache. Wait for any error or the notification.

 

Also, provide the exact versions you have of Alfred, the Workflow, and macOS.

Link to comment

You need to keep waiting, not enough time has passed.

 

That error is unrelated but it also doesn’t make sense. Either you’ve changed something in the Workflow, or there’s something atypical about your system which I can’t check for.

Link to comment

Thanks so much for creating this Vitor. Work flow life saver – working really well for me on OS 11.6 and Alfred 4.5.1.

 

In case anyone else encounters this error:

[16:48:04.688] ERROR: Google Drive[Run Script] /Users/MyName/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.1C049923-5A50-4A1B-BE98-4BC2A04C2F68/rebuild_cache:26:in 'atime': No such file or directory @ rb_file_s_atime - /Volumes/GoogleDrive/My Drive/<various subfolders>/r_m_24_d_2*_f127v.tif (Errno::ENOENT)

 

My guess is that it was some sort of sync error already occurring in Google Drive (maybe to do with the asterisk in the filename) – the file was visible on google drive but hadn't appeared in the streamed folder on my mac. I downloaded the file to the desktop, renamed it without the suspect symbol, deleted the old version from the google drive online to be sure and then added it back into the streamed directory so it resynced. After that, all of the steps in the script setup worked fine (about 25 mins to index 1.33 TB, in case that helps anyone as a time guide). 

 

Edited by Matt2B2
Link to comment
5 hours ago, Matt2B2 said:

Thanks so much for creating this Vitor. Work flow life saver – working really well for me on OS 11.6 and Alfred 4.5.1.

 

Glad to know!

 

6 hours ago, Matt2B2 said:

My guess is that it was some sort of sync error already occurring in Google Drive

 

I’ve inspected and was unable to reproduce. This does seem an error caused by Google Drive’s sync. Still, I’ve made a new release which would skip the file in the same situation.

 

6 hours ago, Matt2B2 said:

(about 25 mins to index 1.33 TB, in case that helps anyone as a time guide)

 

Appreciated! Number of files is a better indication than size, though. If you’d like to share that number, you can get it via (in a Terminal):

 

find '/Volumes/GoogleDrive/My Drive' | wc -l

Link to comment
4 hours ago, giovanni said:

Would it be possible to limit the output to folders

 

Doing so would require a tradeoff, like a larger cache or slower cache build. Not worth it to make the Workflow worse for everyone for a niche request.

Link to comment
On 10/6/2021 at 5:26 PM, vitor said:

Appreciated! Number of files is a better indication than size, though. If you’d like to share that number, you can get it via (in a Terminal):

 

 

find '/Volumes/GoogleDrive/My Drive' | wc -l

 

Thanks for this. It was about 25 mins to index 1.33 TB, comprised of 111467 files. 

Link to comment

Hi,

Didn't have time to get back to it until now. 

Reading the other comments, I'm wondering if there isn't an adaptation of the script needed if our computer is not set in English, like I am.

 

find '/Volumes/GoogleDrive/My Drive' | wc -l

didn't work for me, I had to adapt it to "Mon Drive" to make the command work.  (100711 files for me)

Would this explain why the WF didn't work?

I didn't dare edit anything in the script.

Capture d’écran 2021-10-08 à 17.26.43.png

Capture d’écran 2021-10-08 à 17.26.33.png

Link to comment

@Emal See the top post (or the Workflow’s README). You are supposed to change that /Volumes/GoogleDrive/My Drive path if your Google Drive is in a different location. That’s the default path but it’s in that location precisely so you can edit it. That would explain why it didn’t work for you before, yes.

Link to comment
On 10/8/2021 at 4:40 PM, vitor said:

@Emal See the top post (or the Workflow’s README). You are supposed to change that /Volumes/GoogleDrive/My Drive path if your Google Drive is in a different location. That’s the default path but it’s in that location precisely so you can edit it. That would explain why it didn’t work for you before, yes.

 

So, i must change "/Volumes/GoogleDrive/My Drive" to "/Volumes/Google Drive/O meu disco"?

Note: "Google Drive" has a space between Google and Drive. Do i mantain it?

Captura de ecrã 2021-10-14, às 11.17.13.jpg

Link to comment
4 hours ago, deanishe said:

 

That’s Finder lying about the name. The actual volume is called GoogleDrive (no space). Double check by running ls /Volumes in a shell or entering /Volumes/ in Alfred.

 

results this in alfred: "/volumes/Google Drive/O meu disco/"

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...