2016-09-15 54 views
0

嘗試在Win2012服務器上使用PowerShell,Amazonberry Pro 4.7的Cloudberry Explorer連接並將.json文件從本地服務器目錄推送到AWS S3存儲桶。Select-CloudFolder:重定向位置爲空

在PowerShell腳本的運行,我得到錯誤:

選擇-CloudFolder:重定向位置是空的 在C:\ SrcFiles \ AE_Time \ s3_json_upload.ps1:20字符:22 + $目標= $ S3 | Select-CloudFolder -path'time-tracker-staging-import/accou ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~類別信息:未指定:(:) .Exception,CloudBerryLab.Explorer.PSSnapIn.Commands.SelectCloudFolder

Copy-CloudItem:無法將參數綁定到參數'Destination',因爲它爲空。 在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 \日誌

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" 

回答

0

這是因爲你缺少路徑。

以下內容應該有助於您的挑戰。

Add-PSSnapin CloudBerryLab.Explorer.PSSnapIn 
Set-CloudOption -ProxyAddress xxxx -ProxyPort xxxx -PathStyle Path 
$key = "xxxx" 
$secret = "xxxx" 
$s3 = Get-CloudS3Connection -Key $key -Secret $secret 
$source = $s3 | Select-CloudFolder -path TestAutoSync/backup 
0

在管理單元(4.6+),你必須在腳本Set-CloudOption -PathStyle VHost的新版本。

是混淆給出了這個文檔,它說...

-PathStyle - Path style if this flag is specified. VHost otherwise.

......不知何故這並不意味着虛擬主機是默認。你必須明確地將VHost設置爲腳本中的PathStyle。