But searching recursively is already easy enough to do in XY... the whole point of the script is to get around XY's shortcoming.kotlmg wrote:can you please add search subfolders recursively to the above code. i.e the code should have two options i.e. 1. search non recursively and 2. search recursively.
If you really want to change the behavior of the script then end your query with "/r" which will prevent the script from appending "/" and tells XY to search recursively.
EDIT: Before you insist...
Code: Select all
"Search Folders||1 : flat"
// 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");
}
// If no suffix found: default to non-recursive.
Global($suffix);
if (! IsSet($suffix) OR $suffix Like '') {
$suffix = ' /';
}
// We add a suffix (typically '/' or '/r') to the query
// if it isn't already there to control XY's search behavior..
$query = RegexReplace("$query", '^([^/]*)$', "$1$suffix");
// Perform quick search.
Goto "$location?$query";
"Search Folders Recursively : recurse"
Global($suffix);
$suffix = ' /r';
Sub('flat');Code: Select all
@search=Global($query);$query="<@0>";Load('SearchSubfolders.xys');
@flatSearch=Global($query);$query="<@0>";Load('SearchSubfolders.xys', 'flat');
@recursiveSearch=Global($query);$query="<@0>";Load('SearchSubfolders.xys', 'recurse');
XYplorer Beta Club