< Back

Invoke-B2ItemDownload

Sun Jan 19, 2020 5:52 pm

NAME Invoke-B2ItemDownload



SYNOPSIS

The Invoke-B2ItemDownload cmdlet downloads files by either the file ID or file name.





SYNTAX

Invoke-B2ItemDownload [-ID] <String> [-OutFile] <String> [-ApiDownloadUri <Uri>] [-ApiToken <String>] [-WhatIf]

[-Confirm] [<CommonParameters>]



Invoke-B2ItemDownload [-Name] <String> [-BucketName] <String> [-OutFile] <String> [-ApiDownloadUri <Uri>]

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





DESCRIPTION

The Invoke-B2ItemDownload cmdlet downloads files by either the file ID or file name.

When downloading by the file name the bucket ID the file resides in must be specified.



An API key is reuqired to use this cmdlet.





PARAMETERS

-ID <String>

The Uri for the B2 Api query.



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-Name <String>

The Uri for the B2 Api query.



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-BucketName <String>

The Uri for the B2 Api query.



Required? true

Position? 2

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-OutFile <String>

The Uri for the B2 Api query.



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ApiDownloadUri <Uri>

The Uri for the B2 Api query.



Required? false

Position? named

Default value $script:SavedB2DownloadUri

Accept pipeline input? false

Accept wildcard characters? false



-ApiToken <String>

The authorization token for the B2 account.



Required? false

Position? named

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

System.String



This cmdlet takes the FileID, FileName, BucketName, OutFile, and ApiToken as strings.



System.Uri



This cmdlet takes the ApiUri as a uri.





OUTPUTS

None



The cmdlet has no outputs.





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



PS C:\\>Invoke-B2ItemDownload -FileID

4_h4a48fe8875c6214145260818_f000000000000472a_d20140104_m032022_c001_v0000123_t0104 -OutFile C:\\hello.txt



The cmdlet above will download the file with the given ID and place it at the root of the C: drive with the name

hello.txt.









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



PS C:\\>Invoke-B2ItemDownload -FileName hello.txt -BucketName text -OutFile C:\\hello.txt



The cmdlet above will download the file with the given name from the given bucket name and place it at the root of

the C: drive with the name hello.txt.









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Get-B2Bucket | Get-B2ChildItem | ForEach-Object {Invoke-B2ItemDownload -FileID $_.ID -OutFile .\\$_.Name}



The cmdlet above will download the first 1000 files in all buckets and place them in the current directory.











RELATED LINKS

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