Skip to content

Instantly share code, notes, and snippets.

@arthurdent
arthurdent / Get-FtpDirectory.ps1
Created April 1, 2015 22:11
Recursively list all files in FTP directory in PowerShell / List files (recursive)
$Server = "ftp://ftp.example.com/"
$User = "anonymous@example.com"
$Pass = "anonymous@anonymous.com"
Function Get-FtpDirectory($Directory) {
# Credentials
$FTPRequest = [System.Net.FtpWebRequest]::Create("$($Server)$($Directory)")
$FTPRequest.Credentials = New-Object System.Net.NetworkCredential($User,$Pass)
$FTPRequest.Method = [System.Net.WebRequestMethods+FTP]::ListDirectoryDetails

Keybase proof

I hereby claim:

  • I am arthurdent on github.
  • I am x2a (https://keybase.io/x2a) on keybase.
  • I have a public key ASCNGD9MEXiksRws6Sp0r8_XdCffRA-K3potNQ2Z_h7nqQo

To claim this, I am signing this object: