FAQ
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 <denim.live@yahoo.com>
Date: Wed, 25 Aug 2010 07:36:11 +0000 (GMT)
To: <common-user@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.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommon-user @
categorieshadoop
postedAug 25, '10 at 7:22p
activeAug 25, '10 at 7:22p
posts1
users1
websitehadoop.apache.org...
irc#hadoop

1 user in discussion

Sudhir Vallamkondu: 1 post

People

Translate

site design / logo © 2022 Grokbase