FTP LIST command
-
At the moment it seems that the
ls
command does not accept apathname
arg. This means that thels
command only returns the file list ofpwd
.From the RCF959
This command causes a list to be sent from the server to the passive DTP. If the pathname specifies a directory or other group of files, the server should transfer a list of files in the specified directory. If the pathname specifies a file then the server should send current information on the file. A null argument implies the user's current working or default directory.
If I want to list files in a dir I have to first
cd
into it, which causes thepwd
to be updated. -
-
@dc42 will this be added to firmware or it's not a priority?
-
@AndMaz I have attempted to add it, but Filezilla won't execute LIST as a custom command even if I send PASV first, and Windows built-in FTP client doesn't work with RRF (perhaps it uses multiple connections). Can you suggest any other way for me to test it?
-
@dc42 I'm using a nodejs lib as my client. Here's link to it https://github.com/patrickjuchli/basic-ftp#readme and a basic example:
const ftp = require("basic-ftp"); /** @type {import('basic-ftp').AccessOptions} */ const connectionOpts = { host: "0.0.0.0", port: 2221, user: "user", password: "password", secure: false, }; async function runner() { const client = new ftp.Client(); // client.ftp.verbose = true; try { await client.access(connectionOpts); // await client.cd("backup"); const list = await client.list("backup"); console.log("List of files:"); console.log(list.map((item) => item.name)); } catch (error) { console.log("Error"); console.log(error); } finally { client.close(); } } runner();
-
@AndMaz if I post a binary for you to try, can you test it? Which Duet do you have?
-
@dc42 I'm using Duet 2. Yes, I can test the binary.
-
@AndMaz please try the binary at https://www.dropbox.com/sh/98qrnptof093atm/AABlb0CtCeQWCuKUJDxeCPVsa?dl=0. It is based on the RRF 3.5beta source so I suggest you don't use it for printing unless you are already running 3.5beta2.
-
@dc42 sorry for the delay. Tested here and now I can
ftp
into the device and then usels <dir>
to get the file list.Now I have an issue on my side. My ftp client issues a
LIST -a <dir>
and not aLIST <dir>
so I'm getting an empty list as a response. Don't know about the-a
flag as it is not specified in the RFC. I guess that the client just tries to mimic FileZilla (https://forum.filezilla-project.org/viewtopic.php?t=7237) and forces the server to show all the files (even the hidden ones).Note: ForkLift @ macOS also sends a
LIST -a
command so it gets a empty array. Don't know if you want to add support for this flag just to avoid receiving new tickets in hereAll of this is just to say that what you've done is working fine. Now I just have to fix things on my side.
Thank you for quickly solving this
-
-
-
@AndMaz thanks for testing this.