Regarding the listing order, .7z formats differ with other archive formats (e.g. tar, zip, rar etc.). I have files in this structure:
❯ tree d1 d2
d1
├── d12
│ └── file
└── file
d2
└── file
Compress it now using 7z a a.7z d1 d2, then list it via 7z l a.7z, one can see output:
Date Time Attr Size Compressed Name
------------------- ----- ------------ ------------ ------------------------
2026-07-31 15:53:08 D.... 0 0 d1
2026-07-31 15:53:10 D.... 0 0 d1/d12
2026-07-31 15:52:56 D.... 0 0 d2
2026-07-31 15:53:10 ....A 0 0 d1/d12/file
2026-07-26 03:02:10 ....A 0 0 d1/file
2026-07-26 03:02:14 ....A 0 0 d2/file
------------------- ----- ------------ ------------ ------------------------
2026-07-31 15:53:10 0 0 3 files, 3 folders
Seems 7z groups directory together. As a comparison, other archive formats add files in a DFS order:
❯ zip -Z store -r a.zip d1 d2; 7z l a.zip
...
Date Time Attr Size Compressed Name
------------------- ----- ------------ ------------ ------------------------
2026-07-31 15:53:08 D.... 0 0 d1
2026-07-26 03:02:10 ..... 0 0 d1/file
2026-07-31 15:53:10 D.... 0 0 d1/d12
2026-07-31 15:53:10 ..... 0 0 d1/d12/file
2026-07-31 15:52:56 D.... 0 0 d2
2026-07-26 03:02:14 ..... 0 0 d2/file
------------------- ----- ------------ ------------ ------------------------
2026-07-31 15:53:10 0 0 3 files, 3 folders
This effectively causes yazi bug: https://github.com/sxyazi/yazi/issues/4162 so I'm just wondering - is there any specific reason 7z adds files in this special order?
This is not necessarily a bug though however due to yazi's design philosophy they don't want to handle 7z's case on their side. Due to the fact I've observed that 7z l reads and stages all the archive entries in memory and then outputs them all at once, it it reasonable to add a cli switch for 7z l to "sort" them before output?
A copy from yazi's author as a reference, stating the idea -
Thanks in advance!
7z stores files in "solid" groups for better compression.
Directory entry is just metadata without data. So directory entries are stored outside of file groups.