hdfsDelete()

Supported by libMapRClient for hadoop-2.x

Deletes the specified directory or file.

Signature

int hdfsDelete(hdfsFS fs, const char* path, int recursive)

Parameters

Parameter Description
fs The handle of the filesystem where the file or directory to delete is located. Obtain this handle with one of the hdfsConnect() APIs.
path The path of the file.
recursive A value of 0 deletes the specified directory, if the directory is empty. If the directory is not empty, an error is returned.

A non-zero value deletes the specified directory and all of its subdirectories.

If the specified object is a file, not a directory, this parameter is ignored.

Return Value

Returns 0 on success, -1 on error.

Check errno for error codes and meanings. Some of the key errors are ESTALE, EACCES, and EPERM.