Graham
admin_teGa This simple example search will take the first word of a query and filter the filelist to only show files that contain that word anywhere in the file name
Everything after a space in the query is ignored and trimmed off
The
*.* in the filter means it will only list files with an extension so you do not need to put the extension in the query
<!--parser:xtscript-->
get search
var $spc=call chr $val=32
var $first_space = call strpos $haystack=$search;$needle=$spc
if $first_space
var $search= call substr $val=$search;$start=0;$length=$first_space
endif
<!--/parser:xtscript-->
<form action="<xt:url />" method="get">
<input type="search" name="search" value="{_$$search|}" />
<input type="submit" value="search" />
</form>
<xt:filelist sort_type="name" sort_dir="asc" folder="/files" template="" per_page="3" filter="*{_$$search|}*.*"/>
Copy code
this search would find the files in your examples from either query as it would find the word "bad" or "you" in the file name