読者です 読者をやめる 読者になる 読者になる

qshinoの日記

Powershell関係と徒然なこと

ftp by webclient by powershell

ftp up/download

local.txtをftpサーバーに送信&受信

$user   = 'me'
$pw     = 'pass'
$url      = 'ftp://host.jp/'

$wc = New-Object System.Net.WebClient
$wc.Credentials = New-Object System.Net.NetworkCredential($user,$pw)

$wc.BaseAddress = $url
$wc.UploadFile("remote.txt","local.txt")
$wc.DownloadFile("remote.txt","local2.txt")
$wc.Dispose()

参考

http://tech.lecume.net/power-shell/ftp-connect