Quantcast
Channel: foreach | Operating systems, scripting, PowerShell and security | jesusninoc.com
Viewing all articles
Browse latest Browse all 409

Upload files to FTP automatically and save a copy

$
0
0

ForEach ($file in gci F:\power\videos){
$file

$ftp=”ftp://user:pass@domain.com/pub/$File”
$webclient = New-Object System.Net.WebClient
$uri = New-Object System.Uri($ftp)
$webclient.UploadFile($uri, $file)

Move-Item $file.Fullname F:\power\copia
$file.FullName | Out-File F:\power\copiados.txt -Append
}

The post Upload files to FTP automatically and save a copy appeared first on Scripting and Security.


Viewing all articles
Browse latest Browse all 409

Trending Articles