Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #SET FOLDER PATH
- $folderPath= $ftp + "/" + $folder + "/"
- $Allfiles=Get-FTPDir -url $folderPath -credentials $credentials
- $files = ($Allfiles -split "`r`n")
- $files
- $webclient = New-Object System.Net.WebClient
- $webclient.Credentials = New-Object System.Net.NetworkCredential($user,$pass)
- $counter = 0
- foreach ($file in ($files | where {$_ -like "*.txt"})){
- $source=$folderPath + $file
- $destination = $target + $file
- $webclient.DownloadFile($source, $target+$file)
- #PRINT FILE NAME AND COUNTER
- $counter++
- $counter
- $source
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement