PoshCode Archive  Artifact [7595606499]

Artifact 75956064991df50d718a542174555f9dbffe780e5f12ddf7adc9d7bcc8d9194b:

  • File FTP-upload.ps1 — part of check-in [720525cacb] at 2018-06-10 13:44:57 on branch trunk — how can we zip and upload a file to a FTP cloud through powershell? (user: Stephen Price size: 605)

# encoding: ascii
# api: powershell
# title: FTP upload
# description: how can we zip and upload a file to a FTP cloud through powershell?
# version: 0.1
# author: Stephen Price
# license: CC0
# x-poshcode-id: 4714
# x-archived: 2016-06-28T02:20:12
# x-published: 2016-12-19T07:34:00
#
# please help me.
# thanks
#
$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)