Skip to content

Instantly share code, notes, and snippets.

View gitfvb's full-sized avatar
👋

Florian von Bracht gitfvb

👋
View GitHub Profile
@pmolchanov
pmolchanov / S3UpDown.ps1
Created September 7, 2016 18:00
Quick n Dirty S3 Upload/Download for Powershell
# Upload
&{
$ErrorActionPreference = 'Stop'
$AWSRegion = "us-east-1"
$AWSAccessKeyId = "TODO: Access Key"
$AWSSecretAccessKey = "TODO: Secret Access Key"
$BucketName = "TODO: Bucket Name"
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
$OpenFileDialog.ShowDialog() | Out-Null
# references:
# https://community.spiceworks.com/topic/380201-using-powershell-to-check-for-new-files-in-a-directory
# https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/register-objectevent
# https://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher
# you can change $p to whatever path you want, you can also add file filters, and add more events
# i am monitoring a folder for all create/delete events and color coding output
$p = $pwd.path
$w = New-Object System.IO.FileSystemWatcher $p
$w.IncludeSubdirectories = $true