< Back

Set-AzureStorageFileContent

Tue Jan 29, 2019 9:28 pm

NAME Set-AzureStorageFileContent



SYNOPSIS

Uploads the contents of a file.





SYNTAX

Set-AzureStorageFileContent [-ShareName] <String> [-Source] <String> [[-Path] <String>] [-ClientTimeoutPerRequest <Int32>] [-ConcurrentTaskCount

<Int32>] [-Context <IStorageContext>] [-Force] [-PassThru] [-ServerTimeoutPerRequest <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]



Set-AzureStorageFileContent [-Directory] <CloudFileDirectory> [-Source] <String> [[-Path] <String>] [-ClientTimeoutPerRequest <Int32>]

[-ConcurrentTaskCount <Int32>] [-Force] [-PassThru] [-ServerTimeoutPerRequest <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]



Set-AzureStorageFileContent [-Share] <CloudFileShare> [-Source] <String> [[-Path] <String>] [-ClientTimeoutPerRequest <Int32>]

[-ConcurrentTaskCount <Int32>] [-Force] [-PassThru] [-ServerTimeoutPerRequest <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]





DESCRIPTION

The Set-AzureStorageFileContent cmdlet uploads the contents of a file to a file on a specified share.





PARAMETERS

-ClientTimeoutPerRequest <Int32>

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.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ConcurrentTaskCount <Int32>

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.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Context <IStorageContext>

Specifies an Azure storage context. To obtain a storage context, use the New-AzureStorageContext (./New-AzureStorageContext.md)cmdlet.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName, ByValue)

Accept wildcard characters? false



-Directory <CloudFileDirectory>

Specifies a folder as a CloudFileDirectory object. This cmdlet uploads the file to the folder that this parameter specifies. To obtain a

directory, use the New-AzureStorageDirectory cmdlet. You can also use the Get-AzureStorageFile cmdlet to obtain a directory.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



-Force [<SwitchParameter>]

Indicates that this cmdlet overwrites an existing Azure storage file.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-PassThru [<SwitchParameter>]

Indicates that this cmdlet returns the AzureStorageFile object that it creates or uploads.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Path <String>

Specifies the path of a file or folder. This cmdlet uploads contents to the file that this parameter specifies, or to a file in the folder

that this parameter specifies. If you specify a folder, this cmdlet creates a file that has the same name as the source file.



If you specify a path of a file that does not exist, this cmdlet creates that file and saves the contents to that file. If you specify a file

that already exists, and you specify the Force parameter, this cmdlet overwrites the contents of the file. If you specify a file that already

exists and you do not specify Force , this cmdlet makes no change, and returns an error.



If you specify a path of a folder that does not exist, this cmdlet makes no change, and returns an error.



Required? false

Position? 2

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ServerTimeoutPerRequest <Int32>

Specifies the length of the time-out period for the server part of a request.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Share <CloudFileShare>

Specifies a CloudFileShare object. This cmdlet uploads to a file in the file share this parameter specifies. To obtain a CloudFileShare

object, use the Get-AzureStorageShare cmdlet. This object contains the storage context. If you specify this parameter, do not specify the

Context parameter.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



-ShareName <String>

Specifies the name of the file share. This cmdlet uploads to a file in the file share this parameter specifies.



Required? true

Position? 0

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Source <String>

Specifies the source file that this cmdlet uploads. If you specify a file that does not exist, this cmdlet returns an error.



Required? true

Position? 1

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

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



Required? false

Position? named

Default value False

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 (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

IStorageContext

Parameter 'Context' accepts value of type 'IStorageContext' from the pipeline



CloudFileDirectory

Parameter 'Directory' accepts value of type 'CloudFileDirectory' from the pipeline



CloudFileShare

Parameter 'Share' accepts value of type 'CloudFileShare' from the pipeline





OUTPUTS



NOTES









Example 1: Upload a file in the current folder



PS C:\\>Set-AzureStorageFileContent -ShareName "ContosoShare06" -Source "DataFile37" -Path "ContosoWorkingFolder/CurrentDataFile"



This command uploads a file that is named DataFile37 in the current folder as a file that is named CurrentDataFile in the folder named

ContosoWorkingFolder.





Example 2: Upload all the files in the current folder



PS C:\\>$CurrentFolder = (Get-Item .).FullName

PS C:\\> $Container = Get-AzureStorageShare -Name "ContosoShare06"

PS C:\\> Get-ChildItem -Recurse | Where-Object { $_.GetType().Name -eq "FileInfo"} | ForEach-Object {

$path=$_.FullName.Substring($Currentfolder.Length+1).Replace("\\","/")

Set-AzureStorageFileContent -Share $Container -Source $_.FullName -Path $path -Force

}



This example uses several common Windows PowerShell cmdlets and the current cmdlet to upload all files from the current folder to the root folder

of container ContosoShare06.



The first command gets the name of the current folder and stores it in the $CurrentFolder variable.



The second command uses the Get-AzureStorageShare cmdlet to get the file share named ContosoShare06, and then stores it in the $Container variable.



The final command gets the contents of the current folder and passes each one to the Where-Object cmdlet by using the pipeline operator. That

cmdlet filters out objects that are not files, and then passes the files to the ForEach-Object cmdlet. That cmdlet runs a script block for each

file that creates the appropriate path for it and then uses the current cmdlet to upload the file. The result has the same name and same relative

position with regard to the other files that this example uploads. For more information about script blocks, type `Get-Help about_Script_Blocks`.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... ilecontent

Remove-AzureStorageDirectory

New-AzureStorageDirectory

Get-AzureStorageFileContent