ftsclose
fts_close is a C library function used to finish a directory tree traversal that was started with fts_open. It is part of the File Traversal System (FTS) API, which provides facilities for walking directory hierarchies in a controlled manner. The function is defined in <fts.h> and is available on BSD-derived systems and in GNU libc on Linux.
Prototype: int fts_close(FTS *ftsp); ftsp is the pointer returned by fts_open.
What it does: fts_close releases the resources allocated for the traversal, including memory and any open directory
Return value: On success, fts_close returns 0. On error, it returns -1 and sets errno to indicate
Usage notes: Typical usage involves calling fts_open to obtain an FTS handle, processing entries with fts_read
Common considerations: The FTS interface is POSIX-like but originates from BSD; availability can vary by system.