hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ananth Sarathy <ananth.t.sara...@gmail.com>
Subject Size of Directory in HDFS
Date Wed, 20 Oct 2010 20:17:20 GMT
I am trying to see how what the total size of all the files within a
directory  in HDFS is. I try

Configuration conf = new Configuration();

            Path inFile = new Path(
                    "/MyDir");

            FileSystem fs = inFile.getFileSystem(conf);


            FileStatus status = fs.getFileStatus(inFile);

            System.out.println(status.isDir());
            System.out.println(status.getLen());


But since it's a directory, i get a 0. Anyone have any idea on how I can get
this info? I am using apache hadoop 20.2.

Secondly, I assume FileSystem.getUsed and FileStatus.getLen is in bytes,
correct?

Ananth T Sarathy

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message