PoshCode Archive  Artifact [1ea717e77b]

Artifact 1ea717e77b0ab8160776b5cea29cf10ad233c1ef0dc36108608b9248bdeaa0e5:

  • File FTP-ListDirectory.ps1 — part of check-in [dae4d0c2a9] at 2018-06-10 14:04:23 on branch trunk — An example showing how to get a file listing via ftp. NOTE: the listing comes back in (bad) html… (user: Joel Bennett size: 662)

# 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()