How to get list of child files/directories having parent DataLakeDirectoryClient class instance

Sergey Shabalov 46 Reputation points
2020-10-22T10:48:28.173+00:00

Hello All!

I have to scan whole data lake file system. Having code like:
PagedIterable<PathItem> pItems = ((DataLakeFileSystemClient)prmParent).listPaths();
for( PathItem pItem : pItems ){
if pItem.isDirectory() ){
((DataLakeFileSystemClient)prmParent).getDirectoryClient(pItem.getName());
} else {
((DataLakeFileSystemClient)prmParent).getFileClient(pItem.getName());
}
}
I get top level dirs/files. But to drill down there must be method listChild() in DataLakeDirectoryClient class.
But i did not find anything similar.
Does anybody know what is the proper way to walk thru the tree?

Thanks. Sergiy

Azure Data Lake Storage
Azure Data Lake Storage
An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
1,492 questions
0 comments No comments
{count} votes

Accepted answer
  1. MartinJaffer-MSFT 26,096 Reputation points
    2020-10-22T19:24:13.057+00:00

    Hello @Sergey Shabalov and welcome to Microsoft Q&A.

    The DataLakeFileSystemClient has method GetPaths which includes both a path parameter and a recursive option. Wouldn't using these together eliminate the need for implementing a tree traversal yourself?

    Please let me know if I misunderstood something.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.