From WikiChip
Difference between revisions of "mirc/identifiers/$finddir"
< mirc‎ | identifiers

(See Also)
Line 1: Line 1:
{{mirc title|$finddir Identifier}}'''$finddir''' Searches the specified directory (and optionally its subdirectories) for the Nth directory matching the wildcard specification and returns the path if it is found.
+
{{mirc title|$finddir Identifier}}'''$finddir''' Searches the specified directory (and optionally its subdirectories) for the Nth directory matching the {{mirc|wildcard}} specification and returns the path if it is found.
 
== Synopsis ==
 
== Synopsis ==
 
<pre>$finddir(dir, wildcard , N , [depth , [@window | command] ] )</pre>
 
<pre>$finddir(dir, wildcard , N , [depth , [@window | command] ] )</pre>
Line 5: Line 5:
 
== Parameters ==
 
== Parameters ==
 
* '''DIR''' - Name of the starting folder name.
 
* '''DIR''' - Name of the starting folder name.
* '''wildcard''' - directory being searched for. A list of folder names or wildcards seperated by a ';'.
+
* '''wildcard''' - directory being searched for. A list of folder names or {{mirc|wildcard|wildcards}} seperated by a ';'.
 
* '''N''' - Nth sequential directory being searched for. 0 is count of ALL directories.
 
* '''N''' - Nth sequential directory being searched for. 0 is count of ALL directories.
 
* '''depth''' - optional folder depth, counting DIR as the first level. 0 or 1 is DIR level only. If depth not used, there's no depth limit.
 
* '''depth''' - optional folder depth, counting DIR as the first level. 0 or 1 is DIR level only. If depth not used, there's no depth limit.

Revision as of 16:14, 20 October 2018

$finddir Searches the specified directory (and optionally its subdirectories) for the Nth directory matching the wildcard specification and returns the path if it is found.

Synopsis

$finddir(dir, wildcard , N , [depth , [@window | command] ] )

Parameters

  • DIR - Name of the starting folder name.
  • wildcard - directory being searched for. A list of folder names or wildcards seperated by a ';'.
  • N - Nth sequential directory being searched for. 0 is count of ALL directories.
  • depth - optional folder depth, counting DIR as the first level. 0 or 1 is DIR level only. If depth not used, there's no depth limit.
  • command - optional 5th parameter. Can use $finddirn as the sequential number for that directory, or $1- for directory. If the first token in the command is an identifier, $1- will hold the previous values it had and you can preevaluate $1- with $!1- to access the directory.
  • @window - optional 5th parameter. Must be window with side listbox created with -l switch. Each $1- from matching directories is appended as a new line to the side listbox. Is equivalent to: /aline -la @window $1-

Note: DIR can be absolute \path or c:\path or relative to $mircdir. Does not need ending slash. Accepts forward/backward slashes interchangeably but always output backslash.

Properties

  • shortfn - causes N > 0 or $1- within 5th parameter to return short filenames and/or foldernames when a case-insensitive evaluation of the filename is not a valid DOS filename. (Invalid characters, more than 1 period, filename prefix longer than 8, file extension longer than 4, etc)

Note: Returned string can contain multiple consecutive spaces if the file/folder names contain them, causing $file() and other mIRC identifiers to fail. This problem can be avoided by using .shortfn which never contains any spaces.

Example

Compatibility

Added: mIRC v4.7
Added on: 09 Dec 1996
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.


See Also