Created
January 27, 2012 03:20
-
-
Save j3tm0t0/1686790 to your computer and use it in GitHub Desktop.
upload files in some directory to s3 bucket
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-Type -Path "C:\Program Files\AWS SDK for .NET\bin\AWSSDK.dll" | |
$secretKeyID="secretkeyid" | |
$secretAccessKeyID="accesskeyid" | |
$client=[Amazon.AWSClientFactory]::CreateAmazonS3Client($secretAccessKeyID,$secretKeyID) | |
$backup_directory="C:\hoge\" | |
foreach($file in Get-ChildItem -Path $backup_directory){ | |
$request = New-Object -TypeName Amazon.S3.Model.PutObjectRequest | |
[void]$request.WithFilePath($file.fullname) | |
[void]$request.WithBucketName("hoge") | |
[void]$request.WithKey($file.name) | |
[void]$request.WithTimeout(3600000) | |
[void]$client.PutObject($request) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment