I have run into two issues using ListDirectory:
- Bad Packet Length Error when there are a lot of files in the directory.
- Awkward kludge needed to download subset of all files in a directory.
The code I am using is generally similar to that posted by tfsmag at the following link:
I am downloading from a directory which has 480 files in it for 145 MB, with no subdirectories. When I try to do the listing it gives me the packet length error. I was able to get around this by adding a file pattern to the directory parameter,
files = client.ListDirectory("/outgoing/XYZ*");
However doing that gave me an exception that the file was not found on the server.
The reason for this was that FullName property was not being set like I would have expected. I would have expected to see a value of
"/outgoing/XYZ20110930.dat". Instead I was seeing a value of
I was able to get around this by concatenating the Name parameter onto the name of the remote directory instead of using the Fullname property.
Of course I would like to know if the packet length exception was a bug or if there is a better way of listing the directory.