Checking if directory in HDFS is empty or not

前端 未结 2 1763
再見小時候
再見小時候 2021-02-09 18:46

Is there any command in HDFS to check whether a directory is empty or not

2条回答
  •  鱼传尺愫
    2021-02-09 19:37

    count:

    hdfs dfs -count /path
               1            0                  0 /path
    

    The output columns are: DIR_COUNT, FILE_COUNT, CONTENT_SIZE, PATHNAME

    du:

    hdfs dfs -du -s /path
    0  /path
    

    If there are 0 byte files or empty directories, the result would still be 0.

提交回复
热议问题