Create Directory in Azure Data Lake Storage Gen2 | PowerShell Cmdlet | DP-203 Exam Preparation

Create Directory in Azure Data Lake Storage Gen2

Question

You work in a cloud-based company where you have been assigned a task to manage files and directories in Azure Data Lake Storage Gen2

You need to create a directory named first-directory.

Which of the following cmdlet would you use in PowerShell?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Correct Answer: A

A directory reference can be created with cmdlet New-AzDataLakeGen2Item in PowerShell.

The following example shows how a directory first-directory can be added to the container.

$filesystemName = "myfirst-file-system"

$dirname = "first-directory/"

New-AzDataLakeGen2Item -Context $ctx -FileSystem $filesystemName -Path $dirname -Directory.

Option A is correct.

New-AzDataLakeGen2Item cmdlet is used to create a directory.

Option B is incorrect.

There is no command like NewDirectory-AzDataLakeGen2Item.

Option C is incorrect.

There is no command like New-Dir-AzDataLakeGen2Item.

Option D is incorrect.

Cmdlet New-AzDataLakeGen2Item, not Create_directory-AzDataLakeGen2Item is used to create a directory.

To know more about managing files and directories using PowerShell, please visit the below-given link:

The correct PowerShell cmdlet to create a directory in Azure Data Lake Storage Gen2 is A. New-AzDataLakeGen2Item.

Here's a detailed explanation of each option:

A. New-AzDataLakeGen2Item: This is the correct cmdlet to create a new item, including a directory, in Azure Data Lake Storage Gen2 using PowerShell. You can use this cmdlet to create a directory with the specified name.

B. NewDirectory-AzDataLakeGen2Item: This cmdlet does not exist in PowerShell for Azure Data Lake Storage Gen2. It is an invalid cmdlet name.

C. New-Dir-AzDataLakeGen2Item: This cmdlet also does not exist in PowerShell for Azure Data Lake Storage Gen2. It is an invalid cmdlet name.

D. Create_directory-AzDataLakeGen2Item: This cmdlet does not exist in PowerShell for Azure Data Lake Storage Gen2. It is an invalid cmdlet name.

In summary, the correct PowerShell cmdlet to create a directory in Azure Data Lake Storage Gen2 is A. New-AzDataLakeGen2Item.