Checking if directory in HDFS is empty or not

前端 未结 2 1760
再見小時候
再見小時候 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:17

    isEmpty=$(hdfs dfs -count /some/path | awk '{print $2}')
    if [[ $isEmpty -eq 0 ]];then
        echo "Given Path is empty"
        #Do some operation
    else
        echo "Given Path is not empty"
        #Do some operation
    fi
    

提交回复
热议问题