Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement