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:
har:///user/zoo/foo.har/dir1 har:///user/zoo/foo.har/dir2
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:
har:///user/zoo/foo.har/hadoop har:///user/zoo/foo.har/hadoop/dir1 har:///user/zoo/foo.har/hadoop/dir2
Notice that with the modified parent argument, the files have been archived relative
to /user/
rather than /user/hadoop
.