hdfsListDirectory()

Supported by libMapRClient for hadoop-2.x

Gets list of files and directories for a given path. Returns the information in a dynamically allocated array of hdfsFileInfo structures.

hdfsFreeFileInfo() should be called to deallocate memory when this structure is no longer needed.

This method is the equivalent of the ls -l command.

Signature

hdfsFileInfo *hdfsListDirectory(hdfsFS fs, const char* path, int *numEntries)

Parameters

Parameter Description
fs The handle of the filesystem. Obtain this handle with one of the hdfsConnect() APIs.
path The path of the directory.
numEntries Set to the number of files/directories in path. Cannot be 0 or NULL.

Return Value

Returns a dynamically-allocated array of hdfsFileInfo structures on success and NULL on error.

Check errno for error codes and meanings.