4. Looking Up Files in Hadoop Archives

The hdfs dfs -ls command can be used to look up files in Hadoop archives. Using the example /user/zoo/foo.har archive created in the previous section, you would use the following command to list the files in the archive:

hdfs dfs -ls har:///user/zoo/foo.har/

The output would be:


As you may recall, these archives were created with the following command:

hadoop archive -archiveName foo.har -p /user/hadoop dir1 dir2 /user/zoo

If we were to change the command to:

hadoop archive -archiveName foo.har -p /user/ hadoop/dir1 hadoop/dir2 /user/zoo

And then run the following command:

hdfs dfs -ls -R har:///user/zoo/foo.har

The output would be:


Notice that with the modified parent argument, the files have been archived relative to /user/ rather than /user/hadoop.

loading table of contents...