Here's a couple of classes that I wrote to connect and retrieve an array of file paths, names, and sizes from a Windows FTP server. There is high npath/cyclomatic complexity in getFileList() but it is left that way for easy reading of code and for performance, as this method may run (recursively) thousands or more times per request, depending on how many files and directories exist.