Project

General

Profile

$findfile » History » Version 2

Per Amundsen, 08/12/2015 12:48 PM

1 1 Per Amundsen
_Added in 1.9.0_
2
3
*$findfile(dir,wildcard,N,[depth],[@window|command])*
4
5
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.
6
7
*Parameters*
8
9
dir - The directory to search.
10
wildcard - Wildcard to search for.
11
N - If N = 0, number of files, otherwise the Nth filename.
12
[depth] - Maximum folder depth. (optional)
13
[@window|command] - Custom window name to fill with the result or a command to run on each result. (optional)
14
15
*Properties*
16
17
.shortfn - Return the path in a [[$shortfn|shortfn]] format.
18
19
*Example*
20
21
<pre>
22
; Print number of filenames found in $adiircdir.
23 2 Per Amundsen
//echo -ag $findfile($adiircdir,*.*,0)
24 1 Per Amundsen
25 2 Per Amundsen
; Print the 1st filename found.
26
//echo -ag $findfile($adiircdir,*.*,1)
27
28 1 Per Amundsen
; Print all filenames in $adiircdir, when using the command parameter, $1- will hold the path.
29
//noop $findfile($adiircdir,*.*,0,echo -ag $1-)
30
31
</pre>