Skip to content

Instantly share code, notes, and snippets.

@kitmenke
Created September 2, 2017 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kitmenke/7ea006b4d5a0993285fb6a5671409875 to your computer and use it in GitHub Desktop.
Save kitmenke/7ea006b4d5a0993285fb6a5671409875 to your computer and use it in GitHub Desktop.
#!/bin/bash
PARENT_DIR=$1
if [ -z "${PARENT_DIR}" ]; then
echo Missing 1 parameter for HDFS parent directory
exit 1
fi
hdfs dfs -ls ${PARENT_DIR} | awk '{ print $8}' | sed '/^\s*$/d' > dirs.txt
echo ' DIR_COUNT FILE_COUNT CONTENT_SIZE PATHNAME'
while read dir; do
hdfs dfs -count -h $dir
done < dirs.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment