[Bug 3931] New: wildcard decimates directory listing performance (sftp ls)

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Wed Feb 25 11:52:08 AEDT 2026


https://bugzilla.mindrot.org/show_bug.cgi?id=3931

            Bug ID: 3931
           Summary: wildcard decimates directory listing performance (sftp
                    ls)
           Product: Portable OpenSSH
           Version: 9.9p1
          Hardware: amd64
                OS: Windows 11
            Status: NEW
          Severity: normal
          Priority: P5
         Component: sftp
          Assignee: unassigned-bugs at mindrot.org
          Reporter: benjamin.r.lewis at gmail.com

For directories containing many (150+) files:

sftp> ls dir

is an order of magnitude faster than

sftp> ls dir/*


This amount of difference seems inexplicable (both produce identical
output).

Similarly, "ls -l dir/*" takes about 10x longer than "ls -l dir". This
is particularly unfortunate because the former includes the prefix
("dir/") in its output but the latter omits it. For batch use it would
be convenient to produce output lines that include both the file size
(bytes) and the fully qualified filename (including directory prefix)
without severely impinging on performance.

For directories with ~5000 files, using a wildcard makes sftp appear to
hang (nonresponsive to CTRL-C).

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


More information about the openssh-bugs mailing list