EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Can't read directories using ElSimpleFTPSClient ListDirectory()

Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages
Posted: 09/17/2012 20:37:53
by Serge Shevchenko (Standard support level)
Joined: 03/24/2010
Posts: 8

Is there any property or reason why directories are not listed after ElSimpleFTPSClient.ListDirectory() call? This is my sample:

System.Collections.ArrayList res = new System.Collections.ArrayList();
_client.ListDirectory("/In/Test", res, "*", false, true, true);

It returns the list of files in /In directory but not directories. And same for /In/Test.

I hope that I passed my parameters correctly since the description is little bit unclear:

void ListDirectory(string Parameters, ArrayList ResultList);

Path - path to the directory to read
Listing - the list will be filled by ...
Mask - specifies the mask (wildcards) to select the names...
CaseSensitive - specifies whether the mask is case-sensitive.
IncludeFiles - specifies whether the names of the files ...
IncludeDirectories - specifies whether the names of the directories...

I used most of other TElSimpleFTPSClient properties set to the values from the sample project.
Posted: 09/18/2012 00:38:10
by Eugene Mayevski (EldoS Corp.)

I came across similar question on StackOverflow recently (was it yours?) and the problem seems to be server-specific, as per answers given on SO.

However you can try a few things:

try to replace a call to ListDirectory to first GetFileList(), then to MLSD(). In both cases you need to handle OnTextDataLine event to capture command output. See if any of those methods lists directories. It is possible that the server returns directories for one command and doesn't do this for another.

Sincerely yours
Eugene Mayevski
Posted: 09/18/2012 14:46:12
by Serge Shevchenko (Standard support level)
Joined: 03/24/2010
Posts: 8

That was not my post on SO but thank you for pointing me out.

I get the expected result with both GetFileList() and MLSD(), but not ListDirectory();

This is good enough, however I'll be testing my application with two other ftp servers and curious to see how there methods will work there. Thanks a lot!

Note: it looks like there is an alternative method of these two methods use when I do not necessarily have to have a callback, however the use of callback may provide some benefits on other situations.

THank you
Posted: 09/18/2012 14:55:20
by Eugene Mayevski (EldoS Corp.)

This sounds like component's bug - ListDirectory uses either MLSD or LIST (depending on whether MLSD is supported), so if it doesn't return something, then filters you've set (and you've set them right) don't work. I'll move your original message to helpdesk so that our developers could check what's up. And thank you for pointing at the problem with documentation - declarations need fixing.

Sincerely yours
Eugene Mayevski
Posted: 09/18/2012 16:24:44
by Serge Shevchenko (Standard support level)
Joined: 03/24/2010
Posts: 8

This is what GetFileList() receives in OnTextDataLine() should you need it:

"drwxrwxrwx 4 dentalselecttest 50024 4096 Sep 18 01:07 ."
"drwxrwxrwx 2 dentalselecttest 50024 4096 Sep 18 01:04 Test1"

This is what MLSD() receives in OnTextDataLine():

"modify=20120918010759;perm=flcdmpe;type=cdir;unique=811U19EF60;UNIX.group=50024;UNIX.mode=0777;UNIX.owner=50024; ."
"modify=20120918010457;perm=flcdmpe;type=dir;unique=811U19EF65;UNIX.group=50024;UNIX.mode=0777;UNIX.owner=50024; Test1"
Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.



Topic viewed 1244 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!