Project

General

Profile

$finddir » History » Version 7

Per Amundsen, 05/24/2018 10:11 AM

1 1 Per Amundsen
_Added in 1.9.0_
2
3
*$finddir(dir,wildcard,N,[depth],[@window|command])*
4
5 7 Per Amundsen
Searches the specified directory and its sub directories for the Nth directory name matching the [[Scripting_Wildcards|wildcard]] specification and returns the full path and directory if it is found.
6 1 Per Amundsen
7 6 Per Amundsen
_If [[/halt]] is used in the [command], the search is halted instead of the entire script._
8
9 1 Per Amundsen
*Parameters*
10
11
dir - The directory to search.
12 7 Per Amundsen
wildcard - [[Scripting_Wildcards|Wildcard]] to search for.
13 2 Per Amundsen
N - If N = 0, number of directories, otherwise the Nth directory.
14 1 Per Amundsen
[depth] - Maximum folder depth. (optional)
15 4 Per Amundsen
[@window|command] - Custom window name to fill with the result or a command to run on each result. (optional)
16 1 Per Amundsen
17
*Properties*
18
19
.shortfn - Return the path in a [[$shortfn|shortfn]] format.
20 2 Per Amundsen
21
*Example*
22
23
<pre>
24
; Print number of sub directories found in $adiircdir.
25 5 Per Amundsen
//echo -ag $finddir($adiircdir,*.*,0)
26 1 Per Amundsen
27
; Print the 1st directory found.
28 3 Per Amundsen
//echo -ag $finddir($adiircdir,*.*,1)
29 5 Per Amundsen
30
; Print all sub directories in $adiircdir, when using the command parameter, $1- will hold the path.
31
//noop $finddir($adiircdir,*.*,0,echo -ag $1-)
32 2 Per Amundsen
</pre>