I am trying to automate the upload of files to Glacier using Cloudberry Explorer's PowerShell snapin but cannot seem to copy files to my preferred destination. For some reason, the source directory structure is mirrored in the Glacier vault. For example, the following occurs:
- source path: c:\folder1\subfolder1\yyyyMMdd.tar.bz2
- actual destination path: us-east-1/vaultName/c:\folder1\subfolder1\yyyyMMdd.tar.bz2
- preferred destination path: us-east-1/vaultName/yyyyMMdd.tar.bz2
Any ideas on how to change this behavior?
#get name of oldest subfolder. subfolder names are based on date they were generated yyyyMMdd $oldestFolder = Get-ChildItem C:\folder1\subfolder1 -directory -name | Sort-Object -descending | select -last 1 $dateToProcess = $oldestFolder $srcFolder = "C:\folder1\subfolder1\" $dstFolder = $srcFolder # Compress directory before transmission $block = [scriptblock]::Create("7z a -ttar $dstFolder$dateToProcess.tar $srcFolder$dateToProcess; 7z a -tbzip2 $dstFolder$dateToProcess.tar.bz2 $dstFolder$dateToProcess.tar; del $dstFolder$dateToProcess.tar") & $block add-pssnapin CloudBerryLab.Explorer.PSSnapIn # Create connection $conn = Get-CloudGlacierConnection -UseSSL -Key [Access key] -Secret [Secret Key] # Set options Set-CloudOption -GlacierChunkSizeMB 4 Set-CloudOption -GlacierParallelUpload 1 $vault = $conn | Select-CloudFolder -Path "us-east-1/vaultName" $destination = $vault # Select source folder $src = Get-CloudFilesystemConnection | Select-CloudFolder $srcFolder # Upload files to Glacier by filter $src | Copy-CloudItem -Destination $destination -Filter "$dateToProcess.tar.bz2"