get_number_of_files()
#
The function get_number_of_files()
counts the number of files in a directory tree that match a given pattern and options.
Prototype
int get_number_of_files(
hgobj gobj,
const char *root_dir,
const char *pattern,
wd_option opt
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
A handle to the gobj (generic object) system, used for logging and error handling. |
|
|
The root directory where the search begins. |
|
|
A regular expression pattern to match filenames. |
|
|
Options that control the search behavior, such as recursion and file type filtering. |
Return Value
Returns the number of matching files found in the directory tree. Returns -1 on error.
Notes
This function internally uses walk_dir_tree()
to traverse the directory tree and count matching files.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples