Sample Download: http://code.msdn.microsoft.com/CSFTPDownload-b0e10a4b
Developed by Ruiz Yi, the sample demonstrates how to list subdirectories and files of a folder on a FTP server and download all of them.
The operations includes
1. List subdirectories and files of a folder on the FTP server.
When set the Method property of an FtpWebRequest to WebRequestMethods.Ftp.ListDirectoryDetails(the FTP LIST protocol method to get a detailed listing of the files on an FTP server), the response of server will contain many records of information, and each record represents a file or a directory. Depended on the FTP Directory Listing Style of the server, the record is like
12-13-10 12:41PM <DIR> Folder A
12-13-10 12:41PM [Size] File B
NOTE: The date segment is like “12-13-10” instead of “12-13-2010” if Four-digit years is not checked in IIS or other FTP servers..
drwxrwxrwx 1 owner group 0 Dec 1 12:00 Folder A
-rwxrwxrwx 1 owner group [Size] Dec 1 12:00 File B
NOTE: The date segment does not contain year.
2. Download a file on the FTP server.
To download a file, create a FtpWebRequest and set the Method property to WebRequestMethods.Ftp.DownloadFile.
For detailed introduction of the sample, please read the documentation at http://code.msdn.microsoft.com/CSFTPDownload-b0e10a4b
You can find more code samples that demonstrate the most typical programming scenarios by using Microsoft All-In-One Code Framework Sample Browser or Sample Browser Visual Studio extension. They give you the flexibility to search samples, download samples on demand, manage the downloaded samples in a centralized place, and automatically be notified about sample updates. If it is the first time that you hear about Microsoft All-In-One Code Framework, please watch the introduction video on Microsoft Showcase, or read the introduction on our homepage http://1code.codeplex.com/.