You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by Sudhir Vallamkondu <Su...@icrossing.com> on 2010/08/25 21:21:46 UTC

Re: common-user Digest 25 Aug 2010 07:36:47 -0000 Issue 1523

You should use the FileStatus API to access file metadata. See below a
example. 

http://hadoop.apache.org/common/docs/current/api/org/apache/hadoop/fs/FileSt
atus.html

    Configuration conf = new Configuration(); // takes default conf
    FileSystem fs = FileSystem.get(conf);
    Path dir = new Path("/dir");
    FileStatus stat = fs.getFileStatus(dir);
    stat.getPath().toUri().getPath(); // gives directory name
    stat.isDir(); 
    stat.getLen(); 
    stat.getModificationTime();
    stat.getReplication();
    stat.getBlockSize();
    stat.getOwner();
    stat.getGroup();
    stat.getPermission().toString();
  


> From: Denim Live <de...@yahoo.com>
> Date: Wed, 25 Aug 2010 07:36:11 +0000 (GMT)
> To: <co...@hadoop.apache.org>
> Subject: How to enumerate files in the directories?
> 
> Hello, how can one determine the names of the files in a particular hadoop
> directory, programmatically?


iCrossing Privileged and Confidential Information
This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information of iCrossing. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.