Support Questions

Find answers, ask questions, and share your expertise

Can we get file metadata using org.apache.hadoop.fs.FileSystem?

avatar
Expert Contributor

We can use the org.apache.hadoop.fs.FileStatus class to get the file metadata like Block size, File permissions & Ownership, replication factor.

Can we get the same metadata using org.apache.hadoop.fs.FileSystem class. If yes whats the difference between FileSystem and FileSatus class?

Thanks!

1 ACCEPTED SOLUTION

avatar

An instance of FileSystem represents a Hadoop-compatible file system. It provides APIs that map to operations on that underlying file system. A FileStatus represents metadata for one particular file or directory in a file system. You can call the method FileSystem#getFileStatus to obtain a FileStatus instance for any file or directory stored in that file system.

View solution in original post

2 REPLIES 2

avatar

An instance of FileSystem represents a Hadoop-compatible file system. It provides APIs that map to operations on that underlying file system. A FileStatus represents metadata for one particular file or directory in a file system. You can call the method FileSystem#getFileStatus to obtain a FileStatus instance for any file or directory stored in that file system.

avatar
Expert Contributor

Thanks Chris!!