使用 Powershell/AzCopy 将文件从 Azure 文件存储移动到 Dropbox



我正在尝试将文件从 Azure 文件存储中的文件夹移动到 Dropbox 中的文件夹。我不确定如何使用PowerShell实现这一点?

如果您所说的 dropbox 是指工作站上的本地文件夹,则可以使用 Get-AzStorageBlobContentGet-AzStorageFileContent 之类的内容从 Azure 存储中提取文件,然后使用 Move-Item 将它们移动到 Dropbox 文件夹。如果您的意思是与 Dropbox rest api 交谈,您可以在线关注一些文章:

Param(
    [Parameter(Mandatory=$true)]
    [string]$SourceFilePath,
    [Parameter(Mandatory=$true)]
    [string]$TargetFilePath
)
$arg = '{ "path": "' + $TargetFilePath + '", "mode": "add", "autorename": true, "mute": false }'
$authorization = "Bearer " + (get-item env:DropBoxAccessToken).Value
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", $authorization)
$headers.Add("Dropbox-API-Arg", $arg)
$headers.Add("Content-Type", 'application/octet-stream')
Invoke-RestMethod -Uri https://content.dropboxapi.com/2/files/upload -Method Post -InFile $SourceFilePath -Headers $headers

https://laurentkempe.com/2016/04/07/Upload-files-to-DropBox-from-PowerShell/

相关内容

最新更新