尝试在 Win2012 服务器上使用 PowerShell,Amazon S3 Pro 4.7 的 Cloudberry Explorer 连接到本地服务器目录中的 .json 文件并将其推送到 AWS S3 存储桶。
在运行 powershell 脚本时出现错误:
Select-CloudFolder : 重定向位置为空 At C:\SrcFiles\AE_Time\s3_json_upload.ps1:20 char:22 + $destination = $s3 | 选择-CloudFolder -path 'time-tracker-staging-import/accou ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Select-CloudFolder], 异常 + FullyQualifiedErrorId : System.Exception, CloudBerryLab.Explorer.PSSnapIn.Commands.SelectCloudFolder
Copy-CloudItem:无法将参数绑定到参数“目标”,因为它为空。在 C:\SrcFiles\AE_Time\s3_json_upload.ps1:36 char:23 + $src | Copy-CloudItem $destination -filter "*.json" + ~~~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Copy-CloudItem], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,CloudBerryLab.Explorer.PSSnapIn .Commands.CopyCloudItem
我在网上查看了一些关于此的讨论,甚至是 StackOverflow 上的这对夫妇,但它们没有帮助。我不是要自动同步...
获得连接正常,但 CB Explorer 没有生成日志,至少不在 - C:\Users\svc_das\AppData\Local\CloudBerry S3 Explorer PRO\Logs
PowerShell脚本 -
## enable the cloudberry ps-snapin and set path type
add-pssnapin cloudberrylab.explorer.pssnapin
Set-CloudOption -PathStyle path
## set variables with key and secret
$key = 'mykey'
$secret = 'mysecret'
## get connection
$s3 = Get-CloudS3Connection -Key $key -Secret $secret
## set AWS S3 bucket
$destination = $s3 | Select-CloudFolder -path 'time-tracker-staging-import/accounts'
## set local source directory -
$src = Get-CloudFilesystemConnection | Select- CloudFolder "C:\SrcFiles\AE_Time\json_files\accounts\"
## do the copy from local to S3 using a file filter
$src | Copy-CloudItem $destination -filter "*.json"