# encoding: ascii
# api: powershell
# title: FTP ListDirectory
# description: An example showing how to get a file listing via ftp. NOTE: the listing comes back in (bad) html…
# version: 0.1
# author: Joel Bennett
# license: CC0
# x-poshcode-id: 5934
# x-archived: 2016-06-10T15:27:14
# x-published: 2016-07-14T18:24:00
#
#
$cred = Get-Credential
[System.Net.FtpWebRequest]$request = [System.Net.WebRequest]::Create("ftp://joelbennett.net")
$request.Method = [System.Net.WebRequestMethods+FTP]::ListDirectory #Details
$request.Credentials = $cred
$response = $request.GetResponse()
$list = Receive-Stream $response.GetResponseStream()