2017-03-03 2 views

Antwort

3

count:

hdfs dfs -count /path 
      1   0     0 /path 

Die Ausgabespalten sind: DIR_COUNT, FILE_COUNT, CONTENT_SIZE, PATHNAME

du:

hdfs dfs -du -s /path 
0 /path 

Wenn es 0 Byte-Dateien oder leere Verzeichnisse gibt, wäre das Ergebnis immer noch 0.

1
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 
Verwandte Themen