Difference between revisions of "Using Powershell for ftp"
From MyWiki
| Line 1: | Line 1: | ||
'''Reference''' : http://stackoverflow.com/questions/936108/how-to-script-ftp-upload-and-download<br><br> | '''Reference''' : http://stackoverflow.com/questions/936108/how-to-script-ftp-upload-and-download<br><br> | ||
| + | <source lang="powershell"> | ||
| + | Upload: | ||
| + | |||
| + | $File = "D:\Dev\somefilename.zip" | ||
| + | $ftp = "ftp://username:password@example.com/pub/incoming/somefilename.zip" | ||
| + | |||
| + | "ftp url: $ftp" | ||
| + | |||
| + | $webclient = New-Object System.Net.WebClient | ||
| + | $uri = New-Object System.Uri($ftp) | ||
| + | |||
| + | "Uploading $File..." | ||
| + | |||
| + | $webclient.UploadFile($uri, $File) | ||
| + | |||
| + | |||
| + | </source> | ||
Revision as of 14:32, 5 August 2015
Reference : http://stackoverflow.com/questions/936108/how-to-script-ftp-upload-and-download
Upload: $File = "D:\Dev\somefilename.zip" $ftp = "ftp://username:password@example.com/pub/incoming/somefilename.zip" "ftp url: $ftp" $webclient = New-Object System.Net.WebClient $uri = New-Object System.Uri($ftp) "Uploading $File..." $webclient.UploadFile($uri, $File)