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