orlandos-nl / Citadel

SSH Client & Server framework in Swift
MIT License
236 stars 41 forks source link

SFTP listDirectory returns only 100 files #73

Open offle opened 1 month ago

offle commented 1 month ago

Hi, the listDirectory method returns only 100 files.

I've tested it with MacOS Sonoma 14.6.1 and iPhone 15 Pro Simulator in XCode. As server I used the Hostmachine (Sonomo 14.6.1) and a Debian 10 system with the same behaviour.

Sorry, maybe it's not a bug but I can't find any option to override this limit.

Thanks :)

Joannis commented 1 month ago

I don't know what could cause this, but there's certainly no such limit in Citadel.

Joannis commented 1 month ago

Let me know if you run into any ideas on your end

offle commented 1 month ago

Hi, I didn’t find a solution to this. But I think if there’s no such limit in Citadel, the issue can be closed. I will let you know if I will find anything what’s causing this :)

Joannis commented 1 month ago

Thank you :) Even if it's not Citadel I'd love to hear the reason you might find.

Joannis commented 1 month ago

I'll keep it open for my own recordkeeping

offle commented 1 month ago

Hi, short update. I couldn't firgure out the reason for this behavior. I know it's really dirty, but I helped myself with parsing the stdout of an 'ls' command.

`

        let stdout = try await client.executeCommand("ls \(directory)")        
        let lsOut = utils.byteBufferToString(byteBuffer: stdout) ?? ""
        let files = lsOut.split(separator: "\n")
        let sftp = try await client.openSFTP()
        for file in files {
            if (file == "." || file == "..")  {
                continue
            }
            debugPrint(file.filename)
            ...
        }

`

Joannis commented 2 weeks ago

If anyone else runs into this issue as well, or has any ideas about this - please do reach out