Jump to content

Google Drive — List File Stream contents from Google Drive


Recommended Posts

Updates:

  • Check for Full Disk Access in diagnostics.
  • Changed a few messages.
  • gd can trigger cache rebuild when none exists.
  • Automatic cache builds are turned on by default. Can be turned off by changing the auto_refresh Workflow Environment Variable to 0. This supersedes the previous :gdlaunchd.
Edited by vitor
Link to comment

Welcome @markus985,

 

When asking about an existing Workflow, it’s best to use its own thread. Making a new thread, while it seems like it’ll give your problem visibility, fragments the discussion and makes it less likely the author and users of the workflow (the people who can help) will see it.

 

I’ve moved your post into the correct thread.

 

To answer your question, the Workflow does both. By default it opens in the Finder, but you can ⇧↵ to open on the web instead.

Link to comment

Welcome @jgacitua,

 

A Workflow is needed for Google Drive because Spotlight doesn’t index it, so those directories won’t show up just by typing. But if you start with a / (forward slash) you may be able to navigate into them. Or it there’s a directory you frequently copy into, you can make a Workflow from a File Action Triggers to a Run Script Action with default settings and Script mv "${1}" '/PATH/TO/TARGET/DIRECTORY/HERE' (mind the quotes).

Link to comment

Thanks @vitor for your quick answer!

The workflow you created is really helpful, thank you for your work and putting it out there.

 

Taking it a step further maybe.

I wanted to be sure my question was understood.

The plan is seeing Google Drive folders on the Universal Actions window,

when choosing move to  or copy to for example.

 

Is it in your plans to create a workflow for that? :)

 

image.thumb.png.7468cfd8e9d629d606099f34cd6ac05b.png

Link to comment
3 hours ago, jgacitua said:

The workflow you created is really helpful, thank you for your work and putting it out there.

 

Thank you for the kind words.

 

3 hours ago, jgacitua said:

I wanted to be sure my question was understood.

The plan is seeing Google Drive folders on the Universal Actions window,

when choosing move to  or copy to for example.

 

Yep, I understood what you meant. My answer still applies.

 

3 hours ago, jgacitua said:

Is it in your plans to create a workflow for that?

 

But your request got me thinking. While a Workflow can’t override those Copy and Move actions (which is by design, and a good thing), we can add new ones geared specifically to move and copy to Google Drive folders.


Here’s a version which does just that. I’ve tested it and it seems to be working well, but do you want to give it a spin before I make the release official?

Link to comment

Thanks for this workflow, @vitor!

 

I had been clinging on to my Drive Mirror folder since it was still indexed by Spotlight, but I can now finally consider return to the promised land of File Streaming.

 

For others in a similar situation, it seems the default (or default back then) path for the Google Drive Mirror folder was in /Users/[youruser]/Google Drive (with a space).
Although I don't know if changing from Mirror to Stream, which I suspect will change the path to /Volumes/GoogleDrive (since it's the workflow default), would also move or discard the Mirror directory completely.

Edited by Lucky
Link to comment

Hello @vitor
I purchased Alfred just a week or two ago to be able to search through Google Drive. However, I can't get the workflow for Google Drive Search running so far.

I am a novice using Alfred. 


This is my system:
See attachment partial screen.

And this is the Debugging Info:

[14:25:14.063] Google Drive[Script Filter] Script with argv 'factsheet' finished

[14:25:14.064] Google Drive[Script Filter] {"items":[{"title":"Build cache","subtitle":"It will take a few minutes to finish, depending on how many files you have.","arg":"build_cache"}]}

[14:25:15.937] Google Drive[Script Filter] Processing complete

[14:25:15.951] Google Drive[Script Filter] Passing output 'build_cache' to Conditional

[14:25:15.952] Google Drive[Conditional] Processing complete

[14:25:15.953] Google Drive[Conditional] Passing output 'build_cache' to Run Script

[14:25:15.953] Google Drive[Run Script] Processing complete

[14:25:15.954] Google Drive[Run Script] Passing output '' to Run Script

[14:25:16.266] ERROR: Google Drive[Run Script] Google Drive path does not exist!

[14:25:16.267] Google Drive[Run Script] Processing complete

[14:25:16.284] Google Drive[Run Script] Passing output 'PATH_ERROR' to Run Script

[14:25:16.285] Google Drive[Run Script] Passing output 'PATH_ERROR' to Conditional

[14:25:16.286] Google Drive[Conditional] Processing complete

[14:25:16.287] Google Drive[Conditional] Passing output 'PATH_ERROR' to Post Notification

[14:25:16.287] Google Drive[Post Notification] Processing complete

[14:25:16.288] Google Drive[Post Notification] Passing output 'PATH_ERROR' to Play Sound

 

Obviously the path to Google Drive has not been setup correctly or the user rights are not up to par.
 

H-Mbp20 /Volumes % ls

GoogleDrive-107294463187826979929 Macintosh HD

H-Mbp20 /Volumes % cd GoogleDrive-107294463187826979929

hvc@Henks-Mbp20 GoogleDrive-107294463187826979929 % ls

ls: .: Operation not permitted

Could you please help me out?
 

Best regards, H

 

Screenshot 2022-05-12 at 14.44.59.png

Link to comment

Welcome @Henri,

 

Please see the second post on this thread. It teaches you how to properly set the correct Google Drive path and how to provide the necessary information for debugging (I need the output of !gddiagnostic).

 

8 minutes ago, Henri said:

hvc@Henks-Mbp20 GoogleDrive-107294463187826979929 % ls

ls: .: Operation not permitted

 

You probably haven’t given your Terminal Full Disk Access, under System Preferences → Security & Privacy → Privacy → Full Disk Access. Alfred will need it too, to access the directory.

Link to comment

Hi there! 

I seem to be getting a sync of my personal drive, but not my shared drives - is this to be expected/normal behaviour, or is something not working right? The shared drives are available locally, and my Google drive location is set to the parent folder which contains my personal drive and shared drives.

Link to comment

Still love this workflow, unfortunately, it stopped working for me recently. Tried a couple of different drive paths from the original (including another drive account) and did the usual (restart Google Drive), unfortunately nothing worked. Please let me know if you need any other information than the below.

 

Hi, Holden.
### Workflow version
2022.11

### Alfred version
4.6.5

### macOS version
12.3.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
47033 paths

### Cache dir
cache.db

### Cache file
16777221 71658950 -rw-r--r-- 1 holden staff 0 10579968 "May 17 15:28:50 2022" "May 17 15:28:46 2022" "May 17 15:28:46 2022" "May 17 15:26:26 2022" 4096 22656 0 /Users/holden/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
49 minutes ago, vitor said:

 

What exactly does that mean? What are you doing and what is happening (including debugger output)?

 

Nothing is returning in the UI. Looking at the debugger, it appears it is finding the files? (I am just copying a snippet here because the log is very long)

 

[16:30:08.144] Google Drive[Script Filter] Queuing argument 'commerce plan'

[16:30:08.279] Google Drive[Script Filter] Queuing argument 'commerce plann'

[16:30:08.481] Google Drive[Script Filter] Script with argv 'commerce plann' finished

[16:30:08.481] Google Drive[Script Filter] Hi, Holden.

{"items":[{"uid":"/Volumes/GoogleDrive/My Drive/Working/Commerce Planning v2.key","type":"file","title":"Commerce Planning v2.key","subtitle":"/Volumes/GoogleDrive/My Drive/Working/Commerce Planning v2.key","icon":{"path":"/Volumes/GoogleDrive/My Drive/Working/Commerce Planning v2.key","type":"fileicon"},"arg":"/Volumes/GoogleDrive/My Drive/Working/Commerce Planning v2.key"},

 

In the middle of it it does return this error, 

 

[16:30:08.496] ERROR: Google Drive[Script Filter] JSON error: JSON text did not start with array or object and option to allow fragments not set. around line 1, column 0. in JSON:

Hi, Holden.

 

and then continues with a list

 

{"items":[{"uid":"/Volumes/GoogleDrive/My Drive/Working/Commerce Planning v2.key","type":"file","title":"Commerce Planning v2.key","subtitle":"/Volumes/GoogleDrive/My Drive/Working/Commerce Planning v2.key","icon":{"path":"/Volumes/GoogleDrive/My Drive/Working/Commerce Planning v2.key","type":"fileicon"}

image.thumb.png.46273031f7ba24bc3ac2d6544b62a59f.png

 

Link to comment
10 hours ago, vitor said:

Wait, “Hi, Holden.” is really part of the output? That is really weird. Does that mean anything to you? Do you have any file or folder with that in the name?


Ah, yeah - that’s just a zsh profile setting I did a couple years ago to have terminal greet me when I open it.

Link to comment
58 minutes ago, vitor said:


It’s what’s messing the output. In which file did you set it up, and what’s the code?

 

Ah, it been set like what for a while and the workflow was fine. Do you need me to change/delete it for the debugger output?

 

It's just .zshrc and .bash_profile

 

in zhsrc to customize the shell prompt

 

export PS1=">> "
 

and in .bash_profile

 

echo "Hi, Holden."
export PATH=$PATH:/Users/holden/.npm-packages/bin

Link to comment
3 hours ago, hb1 said:

Do you need me to change/delete it for the debugger output?

 

If you delete it, the Workflow will likely start working again.

 

But try just rebooting, first.

 

Please let me know the results, because even if it’s fixed by rebooting or removing, it’ll be a clue.

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