Jump to content

Search within folder currently selected in Finder


Recommended Posts

Hello,

 

I have been attempting for an hour to tweak the template workflow "File System Navigation for specified path" by combining it with "Dynamic File Search" (which works like a charm) in order to be able to type a shortcut while selecting a folder in Finder and find inside it not only its folders, but the files and whatever elements they themselves contain, without having to navigate down the tree... I'm afraid that's not very clear, here's an example : I select folder "iconpacks" (= it's highlighted in blue) in Finder, and instead of being shown its folders, I'd like to be able to search _directly_ for its folders and files – like in a regular "File Search" query, the only difference being that the scope should be the folder I selected in the first place, not my whole computer. Here is my poor attempt (more or less my first custom workflow, show some indulgence...) : https://we.tl/t-KvnccQWYAk. Attached is the result of "File System Navigation for specified path" : as you can see, the files contained by touch_portal_flat_white_iconpack are not shown.

 

Just to make sure I'm making myself understood : the shortcut should trigger a search session or search bar (confused terminology sorry) akin to that triggered by an elementary "File Search", with the only candidates being the result of glob.glob(path_of_folder, recursive=True) in Python.

 

Alfred 4.3.2, High Sierra 10.13

 

Thanks for your time and help!

Capture d’écran 2021-03-07 à 09.07.40.png

Edited by yet_another_alred_user
Typos
Link to post

So basically, you want the Dynamic File Search, but you want to pass in the folder to search in via Hotkey?

 

The reason your workflow isn’t searching in the right place is because a Hotkey doesn’t work quite the same way as a File Filter (in the original Dynamic File Search). A File Filter only emits one path, so you use "scopes": ["{query}"] in the JSON Config to put it into the scopes array.


Current selection in macOS from a Hotkey, on the other hand, is already an array (because it may be multiple files), so you need to change your JSON Config to "scopes": "{query}"

 

Link to post

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