Count the number of HDFs files, size, and number of files in a range of sizes

Source: Internet
Author: User
Tags hadoop fs
Count the number of HDFs files, less than the number of 20M files Hadoop fs-du-h/# statistics File size Hadoop fs-count/# Statistics file number, returned data is directory number, number of files, file total size, input path Hadoop Fs-ls-r/path/data | grep ^-> ~/data.txt #统计所有文件的信息, Filter folders, only statistics files. Because after using ls-l, you can see that the file is "-" beginning with the "D" folder.

And write a little python.

Import pandas as PD
path= '/desktop/data.txt '
df=pd.read_table (path,delim_whitespace=true,names=[ 1,2,3,4,5,6,7,8] # Statistics total 8 column
print (len (DF))
df1=df[df[5]<20971520] # Fifth column is size, take less than 20M (converted to B) file data
Print (Len (DF1)) # Number of statistics

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.