Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

hadoop fs get size of directory java

// import org.apache.hadoop.conf.Configuration;
// import org.apache.hadoop.fs.FileSystem;
// import org.apache.hadoop.fs.Path;

// Test for localhost
Configuration configuration = new Configuration();
configuration.set("fs.defaultFS", "hdfs://localhost:9000");
FileSystem fileSystem = FileSystem.get(configuration);
Path realPath = new Path(path);
System.out.println(fileSystem.getFileStatus(realPath).getLen());
 
PREVIOUS NEXT
Tagged: #hadoop #fs #size #directory #java
ADD COMMENT
Topic
Name
4+5 =