FileSystem exists check using Azure File Data Lake client library for Java

Shibu KV 1 Reputation point
2021-08-12T08:02:41.723+00:00

We have getFileSystemClient API - https://learn.microsoft.com/en-us/java/api/overview/azure/storage-file-datalake-readme?view=azure-java-stable#create-a-datalakefilesystemclient

and create file system API - https://learn.microsoft.com/en-us/java/api/overview/azure/storage-file-datalake-readme?view=azure-java-stable#create-a-file-system

Before saving data into Azure Data Lake File System, how do I check if file-system already exist or not? If file-system does not exist, invoke "create file system API" else getFileSystemClient API.

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,527 questions
{count} votes

1 answer

Sort by: Most helpful
  1. KranthiPakala-MSFT 46,602 Reputation points Microsoft Employee
    2021-08-18T16:39:28.837+00:00

    Hi @Shibu KV ,

    Apologies for the delay in response. Unfortunately DataLakeFileSystemClient does not have an exists method. But even if it did, all it would do is call getProperties API and check for a 4xx error. As a workaround we would recommend you add this as a an exist method in your code, to validate if a file system exist or not.

    I have also discussed this requirement with relevant product team and they are evaluating if they could add it to the SDK in the future.

    Hope this info helps. Do let us know if you have further query.

    ----------

    • Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification.

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.