Advertisement
Guest User

Untitled

a guest
Jul 27th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #SET FOLDER PATH
  2. $folderPath= $ftp + "/" + $folder + "/"
  3.  
  4. $Allfiles=Get-FTPDir -url $folderPath -credentials $credentials
  5. $files = ($Allfiles -split "`r`n")
  6.  
  7. $files
  8.  
  9. $webclient = New-Object System.Net.WebClient
  10. $webclient.Credentials = New-Object System.Net.NetworkCredential($user,$pass)
  11. $counter = 0
  12. foreach ($file in ($files | where {$_ -like "*.txt"})){
  13. $source=$folderPath + $file
  14. $destination = $target + $file
  15. $webclient.DownloadFile($source, $target+$file)
  16.  
  17. #PRINT FILE NAME AND COUNTER
  18. $counter++
  19. $counter
  20. $source
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement