Problem downloading files

0 votes
asked Oct 31, 2011 by Rob T (350 points)
edited Nov 4, 2011

I thought I had this figured out- this should be simple but I can't figure out what my problem is.

The following code is there to:

  1. Get a folder with files inside on the server then
  2. Put that folder with files in a specific folder on the users hard drive

{0} is the folder number based on the value in lblID.Text.

client.GetFiles(
    String.Format("/files/backuplogfiles/{0}", lblID.Text),
    (Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "\DailyLog\Files\*"),
    FtpBatchTransferOptions.Recursive,
    FtpActionOnExistingFiles.OverwriteDifferentSize)

I have similar code that allows the UPLOAD of folders and files and it works fine. I thought to download, it would be a simple reversal of my source and destination.

While my code doesn't error, it just doesn't do anything.

Am I missing something?

1 Answer

+1 vote
answered Oct 31, 2011 by Lukas Matyska (51,690 points)
edited Nov 4, 2011
 
Best answer

It is suspicious the code doesn't fail, because your target path "xxx\*" is illegal. Please ensure you are not catching and silently ignoring an exception.

Please move the '*' wildcard to the source path instead:

client.GetFiles(
    String.Format("/files/backuplogfiles/{0}/*", lblID.Text),
    Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "DailyLog\Files"), 
    FtpBatchTransferOptions.Recursive, 
    FtpActionOnExistingFiles.OverwriteDifferentSize)
commented Oct 31, 2011 by Rob T (350 points)
edited Nov 4, 2011

Perfect- thanks for your help!

...