Edit

Share via


Remove-AzDataLakeGen2Item

Remove a file or directory.

Syntax

ReceiveManual (Default)

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

ItemPipeline

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Context

Azure Storage Context Object

Parameter properties

Type:IStorageContext
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-DefaultProfile

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

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-FileSystem

FileSystem name

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ReceiveManual
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-Force

Force to remove the Filesystem and all content in it

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InputObject

Azure Datalake Gen2 Item Object to remove.

Parameter properties

Type:AzureDataLakeGen2Item
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ItemPipeline
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-PassThru

Return whether the specified Filesystem is successfully removed

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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/'

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ReceiveManual
Position:1
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

String

AzureDataLakeGen2Item

IStorageContext

Outputs

Boolean