The scripting solution...
Save this to a file in your script directory, for now let's call it "SearchSubfolders.xys":
Code: Select all
"Search Folders"
// Try selected paths
$location = Report('{Dir {FullName};||{FullName};}', 1);
// If no selection: try listed paths.
if (! IsSet($location) OR $location Like '') {
$location = Report('{Dir {FullName};||{FullName};}');
}
// If none listed: use current path.
if (! IsSet($location) OR $location Like '') {
$location = "<curpath>";
}
// If no query provided: prompt user.
Global($query);
if (! IsSet($query) OR $query Like '') {
$query = Input('Search Query', "Enter your search terms:<crlf><crlf>Note that if query does not contain '/' then it will be appended to prevent searching subfolders.", "$query");
}
// We add '/' to the query if it isn't there to prevent recursive searching.
$query = RegexReplace("$query", '^([^/]*)$', '$1 /');
Goto "$location?$query";
You could just run the script but let's add an alias so it's not too far off of the quick searches. So run this in your address bar:
Code: Select all
@subSearch=Global($query);$query="<@0>";Load('SearchSubfolders.xys');
Now you can execute it using:
Let me explain the logic in the location determination:
If the current selection contains folders or drives then they are used.
Else if there are any folders or drives currently displayed in the list they are used.
Finally, if neither of those is true it will search the current path. (Not terribly desirable but tough!

)
Also, I add the '/' to the end of the given query (unless it already contains '/'), to tell XY to disable recursive searching.