Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    FTP LIST command

    Scheduled Pinned Locked Moved Solved
    Firmware wishlist
    2
    9
    341
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • AndMazundefined
      AndMaz
      last edited by

      At the moment it seems that the ls command does not accept a pathname arg. This means that the ls command only returns the file list of pwd.

      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 the pwd to be updated.

      1 Reply Last reply Reply Quote 0
      • T3P3Tonyundefined T3P3Tony moved this topic from General Discussion
      • AndMazundefined
        AndMaz
        last edited by

        @dc42 will this be added to firmware or it's not a priority?

        dc42undefined 1 Reply Last reply Reply Quote 0
        • dc42undefined
          dc42 administrators @AndMaz
          last edited by

          @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?

          Duet WiFi hardware designer and firmware engineer
          Please do not ask me for Duet support via PM or email, use the forum
          http://www.escher3d.com, https://miscsolutions.wordpress.com

          AndMazundefined 1 Reply Last reply Reply Quote 0
          • AndMazundefined
            AndMaz @dc42
            last edited by

            @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();
            
            dc42undefined 1 Reply Last reply Reply Quote 0
            • dc42undefined
              dc42 administrators @AndMaz
              last edited by

              @AndMaz if I post a binary for you to try, can you test it? Which Duet do you have?

              Duet WiFi hardware designer and firmware engineer
              Please do not ask me for Duet support via PM or email, use the forum
              http://www.escher3d.com, https://miscsolutions.wordpress.com

              AndMazundefined 1 Reply Last reply Reply Quote 0
              • AndMazundefined
                AndMaz @dc42
                last edited by

                @dc42 I'm using Duet 2. Yes, I can test the binary.

                dc42undefined 1 Reply Last reply Reply Quote 0
                • dc42undefined
                  dc42 administrators @AndMaz
                  last edited by

                  @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.

                  Duet WiFi hardware designer and firmware engineer
                  Please do not ask me for Duet support via PM or email, use the forum
                  http://www.escher3d.com, https://miscsolutions.wordpress.com

                  AndMazundefined 1 Reply Last reply Reply Quote 0
                  • AndMazundefined
                    AndMaz @dc42
                    last edited by AndMaz

                    @dc42 sorry for the delay. Tested here and now I can ftp into the device and then use ls <dir> to get the file list.

                    Now I have an issue on my side. My ftp client issues a LIST -a <dir> and not a LIST <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 here

                    All 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 🙂

                    743f57f8-d846-418d-be3f-c8f46e68ef58-image.png

                    dc42undefined 1 Reply Last reply Reply Quote 0
                    • dc42undefined dc42 marked this topic as a question
                    • dc42undefined dc42 has marked this topic as solved
                    • dc42undefined
                      dc42 administrators @AndMaz
                      last edited by

                      @AndMaz thanks for testing this.

                      Duet WiFi hardware designer and firmware engineer
                      Please do not ask me for Duet support via PM or email, use the forum
                      http://www.escher3d.com, https://miscsolutions.wordpress.com

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post
                      Unless otherwise noted, all forum content is licensed under CC-BY-SA