Advertisement
Guest User

Untitled

a guest
Feb 26th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #requires -version 4.0
  2.  
  3. $Username = Get-ChildItem Env:EW_USERNAME
  4. $Password = Get-ChildItem Env:EW_PASSWORD
  5. $Server = "ftp.eagleweather.com/public_html/assets/img/autoUpdateImages"
  6. $CapturesPath = "C:\Program Files (x86)\InterWARN\Captures"
  7.  
  8. $Client = New-Object System.Net.WebClient
  9. $Client.Credentials = New-Object System.Net.NetworkCredential($Username, $Password)
  10.  
  11. # We only care for pictures.
  12. Get-ChildItem $CapturesPath -Filter *.jpg |
  13. ForEach-Object {
  14. try {
  15. $uri = New-Object System.Uri("$Server\$_.Name")
  16. $Client.UploadFile($uri, $_.FullName)
  17. }
  18. catch {
  19. $_.Exception.Message | Out-File errors.txt -Append
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement