|
Functions for searching files by name patterns. More...
Functions | |
String | findFirstFile (string pattern, bool recurse=true) |
Returns the first file in the directory system matching the given pattern. | |
String | findFirstFileMultiExpr (string pattern, bool recurse=true) |
Returns the first file in the directory system matching the given patterns. | |
String | findNextFile (string pattern="") |
Returns the next file matching a search begun in findFirstFile(). | |
String | findNextFileMultiExpr (string pattern="") |
Returns the next file matching a search begun in findFirstFileMultiExpr(). | |
int | getFileCount (string pattern, bool recurse=true) |
Returns the number of files in the directory tree that match the given patterns. | |
int | getFileCountMultiExpr (string pattern, bool recurse=true) |
Returns the number of files in the directory tree that match the given patterns. |
Functions for searching files by name patterns.
String findFirstFile | ( | string | pattern, | |
bool | recurse = true | |||
) |
Returns the first file in the directory system matching the given pattern.
Use the corresponding findNextFile() to step through the results. If you're only interested in the number of files returned by the pattern match, use getFileCount().
This function differs from findFirstFileMultiExpr() in that it supports a single search pattern being passed in.
pattern | The path and file name pattern to match against. | |
recurse | If true, the search will exhaustively recurse into subdirectories of the given path and match the given filename pattern. |
// Execute all .cs files in a subdirectory and its subdirectories. for( %file = findFirstFile( "subdirectory/*.cs" ); %file !$= ""; %file = findNextFile() ) exec( %file );
String findFirstFileMultiExpr | ( | string | pattern, | |
bool | recurse = true | |||
) |
Returns the first file in the directory system matching the given patterns.
Use the corresponding findNextFileMultiExpr() to step through the results. If you're only interested in the number of files returned by the pattern match, use getFileCountMultiExpr().
This function differs from findFirstFile() in that it supports multiple search patterns to be passed in.
pattern | The path and file name pattern to match against, such as *.cs. Separate multiple patterns with TABs. For example: "*.cs" TAB "*.dso" | |
recurse | If true, the search will exhaustively recurse into subdirectories of the given path and match the given filename patterns. |
// Find all DTS or Collada models %filePatterns = "*.dts" TAB "*.dae"; %fullPath = findFirstFileMultiExpr( %filePatterns ); while ( %fullPath !$= "" ) { echo( %fullPath ); %fullPath = findNextFileMultiExpr( %filePatterns ); }
String findNextFile | ( | string | pattern = "" |
) |
Returns the next file matching a search begun in findFirstFile().
pattern | The path and file name pattern to match against. This is optional and may be left out as it is not used by the code. It is here for legacy reasons. |
// Execute all .cs files in a subdirectory and its subdirectories. for( %file = findFirstFile( "subdirectory/*.cs" ); %file !$= ""; %file = findNextFile() ) exec( %file );
String findNextFileMultiExpr | ( | string | pattern = "" |
) |
Returns the next file matching a search begun in findFirstFileMultiExpr().
pattern | The path and file name pattern to match against. This is optional and may be left out as it is not used by the code. It is here for legacy reasons. |
// Find all DTS or Collada models %filePatterns = "*.dts" TAB "*.dae"; %fullPath = findFirstFileMultiExpr( %filePatterns ); while ( %fullPath !$= "" ) { echo( %fullPath ); %fullPath = findNextFileMultiExpr( %filePatterns ); }
int getFileCount | ( | string | pattern, | |
bool | recurse = true | |||
) |
Returns the number of files in the directory tree that match the given patterns.
This function differs from getFileCountMultiExpr() in that it supports a single search pattern being passed in.
If you're interested in a list of files that match the given pattern and not just the number of files, use findFirstFile() and findNextFile().
pattern | The path and file name pattern to match against. | |
recurse | If true, the search will exhaustively recurse into subdirectories of the given path and match the given filename pattern counting files in subdirectories. |
// Count the number of .cs files in a subdirectory and its subdirectories. getFileCount( "subdirectory/*.cs" );
int getFileCountMultiExpr | ( | string | pattern, | |
bool | recurse = true | |||
) |
Returns the number of files in the directory tree that match the given patterns.
If you're interested in a list of files that match the given patterns and not just the number of files, use findFirstFileMultiExpr() and findNextFileMultiExpr().
pattern | The path and file name pattern to match against, such as *.cs. Separate multiple patterns with TABs. For example: "*.cs" TAB "*.dso" | |
recurse | If true, the search will exhaustively recurse into subdirectories of the given path and match the given filename pattern. |
// Count all DTS or Collada models %filePatterns = "*.dts" TAB "*.dae"; echo( "Nunmer of shape files:" SPC getFileCountMultiExpr( %filePatterns ) );