batmore
batmore

Reputation: 29

Select-CloudFolder : Redirect location is empty

Trying to use PowerShell on Win2012 server, Cloudberry Explorer for Amazon S3 Pro 4.7 to connect to and push .json files from local server directories to AWS S3 buckets.

During run of powershell script I get error:

Select-CloudFolder : Redirect location is empty At C:\SrcFiles\AE_Time\s3_json_upload.ps1:20 char:22 + $destination = $s3 | Select-CloudFolder -path 'time-tracker-staging-import/accou ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Select-CloudFolder], Exception + FullyQualifiedErrorId : System.Exception,CloudBerryLab.Explorer.PSSnapIn.Commands.SelectCloudFolder

Copy-CloudItem : Cannot bind argument to parameter 'Destination' because it is null. At 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

I've looked at on the web and found several discussions about this, even the couple on StackOverflow, but they don't help. I'm not trying to autosync...

Getting the connection works ok, but no logs generated by CB Explorer, at least not at - C:\Users\svc_das\AppData\Local\CloudBerry S3 Explorer PRO\Logs

powershell script -

## 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" 

Upvotes: 0

Views: 793

Answers (2)

Aron
Aron

Reputation: 3571

In newer versions of the snapin (4.6+) you must include Set-CloudOption -PathStyle VHost in your script.

The documentation for this is confusing given that it says...

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

...and somehow this does not mean that VHost is the default. You have to explicitly set VHost as the PathStyle in your script.

Upvotes: 0

evgeny
evgeny

Reputation: 1135

This is because you are missing path.

The following should facilitate your challenge.

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

Upvotes: 0

Related Questions