# 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: 1689
# x-archived: 2017-01-24T14:26:36
# x-published: 2011-03-11T07:26: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()
