Created
February 26, 2017 16:53
-
-
Save ciscoo/d2ddc7f035f93be6ddc51e350850533b to your computer and use it in GitHub Desktop.
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
#requires -version 4.0 | |
$Username = Get-ChildItem Env:EW_USERNAME | |
$Password = Get-ChildItem Env:EW_PASSWORD | |
$Server = "ftp.eagleweather.com/public_html/assets/img/autoUpdateImages" | |
$CapturesPath = "C:\Program Files (x86)\InterWARN\Captures" | |
$Client = New-Object System.Net.WebClient | |
$Client.Credentials = New-Object System.Net.NetworkCredential($Username, $Password) | |
# We only care for pictures. | |
Get-ChildItem $CapturesPath -Filter *.jpg | | |
ForEach-Object { | |
try { | |
$uri = New-Object System.Uri("$Server\$_.Name") | |
$Client.UploadFile($uri, $_.FullName) | |
} | |
catch { | |
$_.Exception.Message | Out-File errors.txt -Append | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment