hdfs_dir()

Description:

Get the list of all files in a specified path.

Syntax:

hdfs_dir(hd, path)

Note:

This external library function (See External Library Guide) lists names of all files in a specified path in an HDFS file system.

Parameter:

hd

An hd connecton

path

A relative path within the path containing the HDFS file

Option:

@d

List names of all directories in the specified path

@p

List the full paths of all directories and files in the specified path

@m

Create a directory; return true if the directory is created, otherwise return false

@r

Delete a directory; return true if the operation is successful, otherwise return false

Return value:

Sequence or Boolean value

Example:

 

A

 

1

=hdfs_open("hdfs://192.168.0.8:9000")

Connect to the HDFS file system.

2

=hdfs_dir@p(A1,"/user")

List the full paths of all directories and files under the /user directory.

3

=hdfs_dir@d(A1,"/user")

List names of all directories under the /user directory.

 

4

=hdfs_dir(A1,"/user")

List all file names under the /dr1 directory.

5

=hdfs_dir@m(A1,"/user/h1")

Create a directory named h1 under the /user directory.

 

6

=hdfs_dir@r(A1,"/user/h1")

Delete the /user/h1 directory.

 

7

=hdfs_close(A1)

Close the HDFS connection.