Philip
Philip

Reputation: 2628

AZCopy returning error because of the Source Folder

I have the following PowerShell script to copy a folders contents up to an Azure Storage Container.

I'm trying to get it working, but I keep getting an error back saying:

[2019/05/13 17:32:31][ERROR] The syntax of the command is incorrect. Error parsing the argument "C:\temp": parameter name is required.

Can anyone see what I'm doing wrong?

$azPath = "C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy"
Set-Location $azPath

$StorageAccountName = "#"
$StorageAccountKey = "#"
$ContainerName = "#"

$SourceFolder = "C:\temp"
$DestURL = "https://$StorageAccountName.blob.core.windows.net/$ContainerName"
$Result = .\AzCopy.exe $SourceFolder $DestURL /BlobType:block /destkey:$StorageAccountKey /Y
$Result

Upvotes: 1

Views: 3439

Answers (1)

Nancy Xiong
Nancy Xiong

Reputation: 28204

You could add parameters /source and /dest, this should be $Result = .\AzCopy.exe /source:$SourceFolder /dest:$DestURL /BlobType:block /destkey:$StorageAccountKey /Y

enter image description here

Upvotes: 2

Related Questions