ftw.h

Overview

Related Modules:

FS

Description:

Provides functions and structures related to file tree traversal.

You can use the functions and structures to traverse files in a specified directory to obtain or process related information.

Since:

1.0

Version:

1.0

Summary

Data Structures

Data Structure Name

Description

FTW

Defines the file tree walker (FTW).

Macros

Macro Name and Value

Description

FTW_F   1

Regular file.

FTW_D   2

Directory.

FTW_DNR   3

Unreadable directory. Its subdirectories will not be traversed.

FTW_NS   4

The data of the stat structure cannot be obtained. The possible cause is that the permission is incorrect.

FTW_SL   5

Symbolic link.

FTW_DP   6

 

FTW_SLN   7

Symbolic link that names a non-existent file.

FTW_PHYS   1

Symbolic links that are not traversed. If not set, symbolic links are traversed by default.

FTW_MOUNT   2

Stay within the same file system.

FTW_CHDIR   4

chdir is called to go to the directory before reading the directory.

FTW_DEPTH   8

All subdirectories will be traversed before the directory itself.

Functions

Function Name

Description

ftw (const char path, int(fn)(const char file, const struct statsb, int flag), int depth)

int 

Traverses a file tree.

nftw (const char path, int(fn)(const char file, const struct statsb, int flag, struct FTW *s), int fd_limit, int flags)

int 

Traverses a file tree.