Get a list of all the files.
Add them to a list of files to be downloaded.
Loop through your list downloading one at a time.
When it is done, take it off you list of 'to be downloaded'
Next file on the list.
It's pretty much like your downloading of a single file, but with a 'foreach loop' wrapped around it.
-
List<string> FilesToDownload = new LIst<string>();
-
FilesToDownload = GetTheFtpDirectoryContentsMethod(URLasStringParameter);//Returns a List
-
foreach (string YogiBear in FilesToDownload)
-
{
-
YourSingleFileDownloadMethod(YogiBear, LocalDestinationPath);
-
}
-
You probably want to do a few things like get the sizes of all the files to be downloaded and make sure there is sufficient room on the local directory. Do some checks that you can reach the source URL, that you have write permissions on the local destination and so on. Basic error handling stuff. But if you start with the stripped-down logic you can bolt on more and more armor until it's bullet proof.