dart_ftpclient icon indicating copy to clipboard operation
dart_ftpclient copied to clipboard

List directory not working

Open yashaswi2000 opened this issue 5 years ago • 17 comments

I am trying to get the list of directories and files in FTP server and getting below error in flutter Unhandled Exception: FTPException: Can't get content of directory. (Response: 500 Command not understood.)

yashaswi2000 avatar Mar 26 '20 05:03 yashaswi2000

It seems like your FTP Server does not understand the MLST Command to list files.

Please enable the debug Flag (FTPClient constructor) and attach the log (remove any sensitive information from the log).

What FTP Server Software do you use?

virtualmarc avatar Mar 26 '20 07:03 virtualmarc

It seems to be working after I replace MLSD with LIST command

yashaswi2000 avatar Mar 26 '20 07:03 yashaswi2000

my server is windows iis

yashaswi2000 avatar Mar 26 '20 07:03 yashaswi2000

LIST normally responds with a human readable version, while MLST/MLSD respond with a machine readable response, so this is not a general solution.

virtualmarc avatar Mar 26 '20 07:03 virtualmarc

ohh ok i will attach the log

yashaswi2000 avatar Mar 26 '20 07:03 yashaswi2000

I/flutter (13572): [26.03.2020 12:42:48.518] Connecting... I/flutter (13572): [26.03.2020 12:42:48.553] < 220 Microsoft FTP Service I/flutter (13572): [26.03.2020 12:42:48.554] > USER pbns I/flutter (13572): [26.03.2020 12:42:48.661] < 331 Password required I/flutter (13572): [26.03.2020 12:42:48.662] > PASS ndms@123 I/flutter (13572): [26.03.2020 12:42:48.767] < 230 User logged in. I/flutter (13572): [26.03.2020 12:42:48.768] Connected! I/flutter (13572): [26.03.2020 12:42:48.775] > PWD I/flutter (13572): [26.03.2020 12:42:48.879] < 257 "/" is current directory. I/flutter (13572): / I/flutter (13572): [26.03.2020 12:42:48.895] > TYPE A I/flutter (13572): [26.03.2020 12:42:48.998] < 200 Type set to A. I/flutter (13572): [26.03.2020 12:42:48.999] > PASV I/flutter (13572): [26.03.2020 12:42:49.102] < 227 Entering Passive Mode (183,82,120,238,200,219). I/flutter (13572): [26.03.2020 12:42:49.107] > MLST I/flutter (13572): [26.03.2020 12:42:49.122] < 500 Command not understood. E/flutter (13572): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: FTPException: Can't get content of directory. (Response: 500 Command not understood.)

yashaswi2000 avatar Mar 26 '20 07:03 yashaswi2000

Thanks!

I will investigate this further.

virtualmarc avatar Mar 26 '20 11:03 virtualmarc

Hi! I'm have the same problem. Is there any temporary solution?

ghost avatar Apr 21 '20 14:04 ghost

well I had the problem because the windows servers don't support MLST/ MLSD commands so I used LIST command it only gives strings as output, not machine-readable output.

yashaswi2000 avatar Apr 21 '20 14:04 yashaswi2000

Thanks for the tip! But I don't know very much about List Command. So, can you explain me or indicate any tutorial?

Again... Thanks for the help!

ghost avatar Apr 21 '20 16:04 ghost

This link is what helped me understand the command, it also has documentation for other FTP commands also, hope it will be helpful.

yashaswi2000 avatar Apr 21 '20 16:04 yashaswi2000

Thanks!

ghost avatar Apr 21 '20 16:04 ghost

I have the same problem. LIST command is working too.

Could you please implement support for LIST command aslo instead of MLSD?

yegor-pelykh avatar Jun 22 '20 12:06 yegor-pelykh

any way to allow folders and files to contain semicolons in their names?

rovannlinhalis avatar Jun 24 '20 20:06 rovannlinhalis

Hello! 👋 The same happens with vsftpd. I'm going to move to ProFTPd and that's it, as the README suggests, but... just for the info 😄

rocboronat avatar Oct 02 '20 13:10 rocboronat

Hi again! Just installed a ProFTPd server, and it doesn't' work either. Same error 😢

rocboronat avatar Oct 07 '20 12:10 rocboronat

I also had problems with the directory listings. In my case I had to switch transfer mode from ascii to binary in listDirectoryContent(). But error was "425 Can't open data connection."

techilla avatar Oct 17 '20 22:10 techilla