Displays file information for a set of paths in the Hadoop file system
We can use this program to display a set of sets of path set directory lists
Package com;
Import java.io.IOException;
Import Java.net.URI;
Import org.apache.hadoop.conf.Configuration;
Import Org.apache.hadoop.fs.FileStatus;
Import Org.apache.hadoop.fs.FileSystem;
Import Org.apache.hadoop.fs.FileUtil;
Import Org.apache.hadoop.fs.Path;
public class Liststatus {
/**
* @param args
* @throws IOException
*/
public static void Main (string[] args) throws IOException {
TODO auto-generated Method Stub
String uri = args[0];
Configuration conf = new configuration ();
FileSystem fs = Filesystem.get (Uri.create (URI), conf);
path[] paths = new Path[args.length];
for (int i = 0; i < paths.length; i++) {
Paths[i] = new Path (args[i]);
}
filestatus[] status = Fs.liststatus (paths);
path[] Listedpaths = fileutil.stat2paths (status);
for (Path p:listedpaths) {
SYSTEM.OUT.PRINTLN (P);
}
}
}
Displays file information for a set of paths in the Hadoop file system