< Back

Remove-B2ItemVersion

Sun Jan 19, 2020 5:52 pm

NAME Remove-B2ItemVersion



SYNOPSIS

Remove-B2ItemVersion will remove the version of a given file.

If the file only has one version the file will be deleted.





SYNTAX

Remove-B2ItemVersion [-Name] <String[]> [-ID] <String[]> [[-Force]] [[-ApiUri] <Uri>] [[-ApiToken] <String>]

[-WhatIf] [-Confirm] [<CommonParameters>]





DESCRIPTION

Remove-B2ItemVersion will remove the version of a given file.

If the file only has one version the file will be deleted.



If the version you delete is the latest version, and there are older versions, then the most recent older version

will become the

current version, and be the one that you'll get when downloading by name.



An API key is required to use this cmdlet.





PARAMETERS

-Name <String[]>

The Name of the file to delete.



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-ID <String[]>

The ID of the file to delete.



Required? true

Position? 2

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-Force [<SwitchParameter>]

Used to bypass confirmation prompts.



Required? false

Position? 3

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-ApiUri <Uri>

The Uri for the B2 Api query.



Required? false

Position? 4

Default value $script:SavedB2ApiUri

Accept pipeline input? false

Accept wildcard characters? false



-ApiToken <String>

The authorization token for the B2 account.



Required? false

Position? 5

Default value $script:SavedB2ApiToken

Accept pipeline input? false

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Confirm [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

PS.B2.RemoveFile





-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Remove-B2ItemVersion -Name items/hello.txt -ID

4_h4a48fe8875c6214145260818_f000000000000472a_d20140104_m032022_c001_v0000123_t0104



Name ID

---- --

typing_test.txt 4_h4a48fe8875c6214145260818_f000000000000472a_d20140104_m032022_c001_v0000123_t0109



The cmdlet above will









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Get-B2Bucket | Get-B2ChildItem | Remove-B2ItemVersion -Force



Name ID

---- --

items/hello.txt 4_h4a48fe8875c6214145260818_f000000000000472a_d20140104_m032022_c001_v0000123_t0104

items/world.txt 4_h4a48fe8875c6214145260818_f000000000000472a_d20140104_m032022_c001_v0000123_t0105



The cmdlet above will remove the latest version of the first 1000 files in all buckets without prompting.

If the file has only one version the file will be deleted.











RELATED LINKS

https://www.backblaze.com/b2/docs/