Editar

Partilhar via


Get-AzStorageFileContent

Downloads the contents of a file.

Syntax

Get-AzStorageFileContent
   [-ShareName] <String>
   [-Path] <String>
   [[-Destination] <String>]
   [-CheckMd5]
   [-PassThru]
   [-Force]
   [-AsJob]
   [-DisAllowTrailingDot]
   [-Context <IStorageContext>]
   [-ServerTimeoutPerRequest <Int32>]
   [-ClientTimeoutPerRequest <Int32>]
   [-DefaultProfile <IAzureContextContainer>]
   [-ConcurrentTaskCount <Int32>]
   [-WhatIf]
   [-Confirm]
   [-PreserveSMBAttribute]
   [<CommonParameters>]
Get-AzStorageFileContent
   [-ShareClient] <ShareClient>
   [-Path] <String>
   [[-Destination] <String>]
   [-CheckMd5]
   [-PassThru]
   [-Force]
   [-AsJob]
   [-Context <IStorageContext>]
   [-ServerTimeoutPerRequest <Int32>]
   [-ClientTimeoutPerRequest <Int32>]
   [-DefaultProfile <IAzureContextContainer>]
   [-ConcurrentTaskCount <Int32>]
   [-WhatIf]
   [-Confirm]
   [-PreserveSMBAttribute]
   [<CommonParameters>]
Get-AzStorageFileContent
   [-ShareDirectoryClient] <ShareDirectoryClient>
   [-Path] <String>
   [[-Destination] <String>]
   [-CheckMd5]
   [-PassThru]
   [-Force]
   [-AsJob]
   [-Context <IStorageContext>]
   [-ServerTimeoutPerRequest <Int32>]
   [-ClientTimeoutPerRequest <Int32>]
   [-DefaultProfile <IAzureContextContainer>]
   [-ConcurrentTaskCount <Int32>]
   [-WhatIf]
   [-Confirm]
   [-PreserveSMBAttribute]
   [<CommonParameters>]
Get-AzStorageFileContent
   [-ShareFileClient] <ShareFileClient>
   [[-Destination] <String>]
   [-CheckMd5]
   [-PassThru]
   [-Force]
   [-AsJob]
   [-Context <IStorageContext>]
   [-ServerTimeoutPerRequest <Int32>]
   [-ClientTimeoutPerRequest <Int32>]
   [-DefaultProfile <IAzureContextContainer>]
   [-ConcurrentTaskCount <Int32>]
   [-WhatIf]
   [-Confirm]
   [-PreserveSMBAttribute]
   [<CommonParameters>]

Description

The Get-AzStorageFileContent cmdlet downloads the contents of a file, and then saves it to a destination that you specify. This cmdlet does not return the contents of the file.

Examples

Example 1: Download a file from a folder

Get-AzStorageFileContent -ShareName "ContosoShare06" -Path "ContosoWorkingFolder/CurrentDataFile"

This command downloads a file that is named CurrentDataFile in the folder ContosoWorkingFolder from the file share ContosoShare06 to current folder.

Example 2: Downloads the files under sample file share

Get-AzStorageFile -ShareName sample | Where-Object {$_.GetType().Name -eq "AzureStorageFile"} | Get-AzStorageFileContent

This example downloads the files under sample file share

Example 3: Download an Azure file to a local file, and perserve the Azure File SMB properties (File Attributtes, File Creation Time, File Last Write Time) in the local file.

Get-AzStorageFileContent -ShareName sample -Path "dir1/file1" -Destination $localFilePath -PreserveSMBAttribute

This example downloads an Azure file to a local file, and perserves the Azure File SMB properties (File Attributtes, File Creation Time, File Last Write Time) in the local file.

Parameters

-AsJob

Run cmdlet in the background.

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

-CheckMd5

Specifies whether to check the Md5 sum for the downloaded file.

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

-ClientTimeoutPerRequest

Specifies the client-side time-out interval, in seconds, for one service request. If the previous call fails in the specified interval, this cmdlet retries the request. If this cmdlet does not receive a successful response before the interval elapses, this cmdlet returns an error.

Type:Nullable<T>[Int32]
Aliases:ClientTimeoutPerRequestInSeconds
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ConcurrentTaskCount

Specifies the maximum concurrent network calls. You can use this parameter to limit the concurrency to throttle local CPU and bandwidth usage by specifying the maximum number of concurrent network calls. The specified value is an absolute count and is not multiplied by the core count. This parameter can help reduce network connection problems in low bandwidth environments, such as 100 kilobits per second. The default value is 10.

Type:Nullable<T>[Int32]
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:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Context

Specifies an Azure Storage context. To obtain a context, use the New-AzStorageContext cmdlet.

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

-Destination

Specifies the destination path. This cmdlet downloads the file contents to the location that this parameter specifies. If you specify the path of a file that does not exist, this cmdlet creates that file, and saves the contents in the new file. If you specify a path of a file that already exists and you specify the Force parameter, the cmdlet overwrites the file. If you specify a path of an existing file and you do not specify Force, the cmdlet prompts you before it continues. If you specify the path of a folder, this cmdlet attempts to create a file that has the name of the Azure storage file.

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

-DisAllowTrailingDot

Disallow trailing dot (.) to suffix directory and file names.

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

-Force

If you specify the path of a file that does not exist, this cmdlet creates that file, and saves the contents in the new file. If you specify a path of a file that already exists and you specify the Force parameter, the cmdlet overwrites the file. If you specify a path of an existing file and you do not specify Force, the cmdlet prompts you before it continues. If you specify the path of a folder, this cmdlet attempts to create a file that has the name of the Azure storage file.

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

-PassThru

Indicates that this cmdlet returns the AzureStorageFile object that it downloads.

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

-Path

Specifies the path of a file. This cmdlet gets the contents the file that this parameter specifies. If the file does not exist, this cmdlet returns an error.

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

-PreserveSMBAttribute

Keep the source File SMB properties (File Attributtes, File Creation Time, File Last Write Time) in destination File. This parameter is only available on Windows.

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

-ServerTimeoutPerRequest

Specifies the service side time-out interval, in seconds, for a request. If the specified interval elapses before the service processes the request, the storage service returns an error.

Type:Nullable<T>[Int32]
Aliases:ServerTimeoutPerRequestInSeconds
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ShareClient

ShareClient object indicated the share where the file would be downloaded.

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

-ShareDirectoryClient

ShareDirectoryClient object indicated the cloud directory where the file would be downloaded.

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

-ShareFileClient

ShareFileClient object indicated the cloud file to be downloaded.

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

-ShareName

Specifies the name of the file share. This cmdlet downloads the contents of the file in the share this parameter specifies.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:False
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:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

ShareClient

ShareDirectoryClient

ShareFileClient

IStorageContext

Outputs

AzureStorageFile