Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there some way to use the Saved Search capability of the OSX finder to create a virtual union directory? I've made it two-thirds of the way to a solution:

  • We want everything in the union-ed directories to display in the virtual directory. However, normally, you must specify some sort of query parameter when composing a search; if you create a search by typing into the Search field, then removing what you've typed, then saving the resulting search, that Saved Search will have no results. This is because the RawQuery in the Saved Search file is simply set to false. If you change this to true, you will see all possible results within the folder.

  • Normally, the Finder only allows you to specify a single directory to return search results from—if you want to search three separate directories, you usually specify the shared parent to all those folders (even if that means you end up having to specify /). However, in the Saved Search file format itself, the "scope" of your query is actually an array of directories—so to search multiple directories, you simply have to add multiple items to that array. (Well, technically, two redundant arrays: SearchScopes and FXScopeArrayOfPaths. However, the second is only used for rendering the scope when editing the query in the Finder.)

The last problem is that that doing this will recursively search the resulting directories—so, if you have a folder within one of the result directories, you'll see the folder in the results, but also all of its contents. Obviously this isn't how real union directories work; what we really want is something similar to a --max-depth parameter, so we only see the files and folders directly within each of the union-ed directories. Is there some way to accomplish this?

share|improve this question
add comment

1 Answer

Try selecting "Other" as a search parameter, then select "File visibility" and set to "Visible items" and leave the search field blank.

It should show all visible files/folders in the directory.

Not sure how to achieve something similar to --max-depth however.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.