FTP ListDirectory (modification of post by view diff)
View followups from Joel Bennett | embed code: <script type="text/javascript" src="http://PoshCode.org/embed/1689"></script>download | new post
An example showing how to get a file listing via ftp. NOTE: the listing comes back in (bad) html…
- $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()
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.
PowerShell Code Repository