get_number_of_files()

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

gobj

hgobj

A handle to the gobj (generic object) system, used for logging and error handling.

root_dir

const char *

The root directory where the search begins.

pattern

const char *

A regular expression pattern to match filenames.

opt

wd_option

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