Powershell FTP upload

#Cmetro-powershell-logoonfigure the folder where the files are which should be uploaded

#FTP server configuration
$ftpserver = “ftp://myftpserver.myurl.com/optionalpath/”
$username = “FTPUSER”
$password = “FTPPASS”

$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 “*.tx*”)){
“Uploading $file…”
$uri = New-Object System.Uri($ftpserver+$file.Name)
$webclient.UploadFile($uri, $file.FullName)

Leave a Reply

Notify of
We use cookies to improve the user-friendliness and stats of the website. Through your visit, you agree with that.