Jump to content

Alfred File Navigation start after Quick File Search


Recommended Posts

So if I know the name of a file buried deep in a set of folders, I would like to be able to do a Quick File Search to find the file and then have an action or hotkey combo to display that file in the File Navigation, rather than starting at root with / or in the home folder with ~.

 

I thought there was a way to do that but now I can't remember/figure it out.

Link to comment

You could use something like this:

 

temp="{query}";
if [ -d $temp ]; then
 osascript -e "tell application \"Alfred 2\" to search \"$temp\""
else
 folder=$(dirname "$temp")
 osascript -e "tell application \"Alfred 2\" to search \"$folder\""
fi

 

Create a file action, name it appropriately, set file type or leave it blank.. make it attach to a Run Script module with this code. If the passed data is a folder, it browses that folder in Alfred (which btw, there is already a "Browse Folder in Alfred" action for folders"), if the passed data is a file, it gets the path to the file and browses that path in Alfred.

 

Is that what you were looking for?

Link to comment

Could be, I just thought it would be built in like the folder option Andrew mentioned.  Not quite sure why this would only work with folders and not files.

 

Seems somewhat arbitrarily restrictive.

 

Well, technically you can't browse a file, so, that's why it's only available on folder results. You could use the code provided above and disable the default "Browse Folder in Alfred" action and just use this one instead if you wanted to, then it would be available for both files and folders.

Link to comment

Well, technically, the feature is called Quick File Search not Quick Folder Search ;).  Therefore I would imagine most people are using this to search for files rather than folders, thus lessening the value of cmd+down.

 

I guess I should move this to feature suggestions as it would allow quick navigation to deeply nested folders where you know a file name but not the folder name or where the first result is a file in the desired folder.

 

edit:  to correct my technicality to make it technically correct.

Edited by jehrler
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...