Re: Size of Directory in HDFS

2010-10-21 Thread Harsh J
> Secondly, I assume FileSystem.getUsed and FileStatus.getLen is in bytes,
> correct?

Yes, this is correct. Lengths of files are returned in bytes.

-- 
Harsh J
www.harshj.com


Re: Size of Directory in HDFS

2010-10-21 Thread Harsh J
It should be doable like this:

FileSystem.getContentSummary(FileStatus.getPath()).getLength();

On Thu, Oct 21, 2010 at 1:47 AM, Ananth Sarathy
 wrote:
> 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
>



-- 
Harsh J
www.harshj.com


Size of Directory in HDFS

2010-10-20 Thread Ananth Sarathy
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