Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. $Directory=”C:test”
  2.  
  3. #FTP server configuration
  4. $ftpserver = “ftp://ftpserver/”
  5. $username = “user”
  6. $password = “pw”
  7.  
  8. $webclient = New-Object System.Net.WebClient
  9.  
  10. $webclient.Credentials = New-Object System.Net.NetworkCredential($username,$password)
  11.  
  12. #Copy each file which type is *.tx*
  13. foreach($file in (dir $Directory “*.txt*”)){
  14. “Uploading $file…”
  15. $uri = New-Object System.Uri($ftpserver+$file.Name)
  16. $webclient.UploadFile($uri, $file.FullName)
  17. }
  18.  
  19. Exception calling "UploadFile" with "2" argument(s): "Excepção durante um pedido WebClient."
  20. At C:UsershomeDesktoptest6.ps1:16 char:1
  21. + $webclient.UploadFile($uri, $file.FullName)
  22. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  23. + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
  24. + FullyQualifiedErrorId : WebException
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement