Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $Directory=”C:test”
- #FTP server configuration
- $ftpserver = “ftp://ftpserver/”
- $username = “user”
- $password = “pw”
- $webclient = New-Object System.Net.WebClient
- $webclient.Credentials = New-Object System.Net.NetworkCredential($username,$password)
- #Copy each file which type is *.tx*
- foreach($file in (dir $Directory “*.txt*”)){
- “Uploading $file…”
- $uri = New-Object System.Uri($ftpserver+$file.Name)
- $webclient.UploadFile($uri, $file.FullName)
- }
- Exception calling "UploadFile" with "2" argument(s): "Excepção durante um pedido WebClient."
- At C:UsershomeDesktoptest6.ps1:16 char:1
- + $webclient.UploadFile($uri, $file.FullName)
- + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
- + FullyQualifiedErrorId : WebException
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement