$findfile » History » Revision 2
Revision 1 (Per Amundsen, 08/12/2015 12:46 PM) → Revision 2/5 (Per Amundsen, 08/12/2015 12:48 PM)
_Added in 1.9.0_ *$findfile(dir,wildcard,N,[depth],[@window|command])* Searches the specified directory and its subdirectories for the Nth filename matching the wildcard file specification and returns the full path and filename if it is found. *Parameters* dir - The directory to search. wildcard - Wildcard to search for. N - If N = 0, number of files, otherwise the Nth filename. [depth] - Maximum folder depth. (optional) [@window|command] - Custom window name to fill with the result or a command to run on each result. (optional) *Properties* .shortfn - Return the path in a [[$shortfn|shortfn]] format. *Example* <pre> ; Print number of filenames found in $adiircdir. //echo //noop $findfile($adiircdir,*.*,0,echo -ag $findfile($adiircdir,*.*,0) $1-) ; Print the 1st filename found. //echo -ag $findfile($adiircdir,*.*,1) ; Print all filenames in $adiircdir, when using the command parameter, $1- will hold the path. //noop $findfile($adiircdir,*.*,0,echo -ag $1-) ; Print the 1st filename found. //echo -ag $findfile($adiircdir,*.*,1) </pre>