Bewerken

Delen via


Remove-AzDataLakeGen2Item

Remove a file or directory.

Syntax

Remove-AzDataLakeGen2Item
      [-FileSystem] <String>
      [-Path] <String>
      [-Force]
      [-AsJob]
      [-PassThru]
      [-Context <IStorageContext>]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzDataLakeGen2Item
      -InputObject <AzureDataLakeGen2Item>
      [-Force]
      [-AsJob]
      [-PassThru]
      [-Context <IStorageContext>]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Remove-AzDataLakeGen2Item cmdlet removes a file or directory from a Storage account. This cmdlet only works if Hierarchical Namespace is enabled for the Storage account. This kind of account can be created by run "New-AzStorageAccount" cmdlet with "-EnableHierarchicalNamespace $true".

Examples

Example 1: Removes a directory

Remove-AzDataLakeGen2Item -FileSystem "filesystem1" -Path "dir1/"

This command removes a directory from a Filesystem.

Example 2: Removes a file without prompt

Remove-AzDataLakeGen2Item -FileSystem "filesystem1" -Path "dir1/file1" -Force

This command removes a directory from a Filesystem, without prompt.

Example 3: Remove all items in a Filesystem with pipeline

Get-AzDataLakeGen2ChildItem -FileSystem "filesystem1" | Remove-AzDataLakeGen2Item -Force

This command removes all items in a Filesystem with pipeline.

Parameters

-AsJob

Run cmdlet in the background

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Context

Azure Storage Context Object

Type:IStorageContext
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-FileSystem

FileSystem name

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Force

Force to remove the Filesystem and all content in it

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

Azure Datalake Gen2 Item Object to remove.

Type:AzureDataLakeGen2Item
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-PassThru

Return whether the specified Filesystem is successfully removed

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Path

The path in the specified Filesystem that should be removed. Can be a file or directory In the format 'directory/file.txt' or 'directory1/directory2/'

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

AzureDataLakeGen2Item

IStorageContext

Outputs

Boolean