Last active
March 7, 2024 08:34
-
-
Save trickymast3r/44d3cfcfde123b7a3814af485eca419d to your computer and use it in GitHub Desktop.
Powershell Awesome
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:\target\" | |
foreach($file in Get-ChildItem -Path $backup_directory){ | |
$request = New-Object -TypeName Amazon.S3.Model.PutObjectRequest | |
[void]$request.WithFilePath($file.fullname) | |
[void]$request.WithBucketName("bucketname") | |
[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