Sort filenames (main before qualified)

Is there any file browser that can be set to sort directory contents such that “report” comes before “report addendum”? And what is the relevant setting? Thanks!

PS: If this has been asked and answered many times, I apologize for the repeat, but my search fu only comes up with people asking about numbers.

I am not sure I understand you. I have this directory with the two files you mention:

henk@boven:~/test/sss> l
total 8
drwxr-xr-x  2 henk wij 4096 May 22 22:25 ./
drwxr-xr-x 29 henk wij 4096 May 22 22:24 ../
-rw-r--r--  1 henk wij    0 May 22 22:25 report
-rw-r--r--  1 henk wij    0 May 22 22:25 report addendum

and Dolphin sows them in the same sequence.

Isn’t that what you want?

That’s exactly what I want, but not what I see. However, based on your comment, I created these two files, and got what you got. Where it goes wrong for me is with an extension, which I didn’t realize when I posted above:

“Report addendum.txt” sorts ahead of “Report.txt” - and I think I’ve figured out the problem, that a space comes “alphabetically” before a period. Adding a trailing space before the extension improves the reedability of directory output, a clunky workaround. Do you know an elegant one?

Which is why you should never describe what you did but copy and paste actual computer output.

Do you know an elegant one?

For pure alphabetical names “ls --sort=version” does what you want.

Thanks, FCP

First I concur with @avidjaar. You should at least show the computer facts. You may add your own story, but it is the computer facts we believe. And you did not even mention what that “file browser” was that you mentioned. All very vague. So please remember this next time.

Then, the sorting you see is not strict alphabetic, but ASCII. And there is not such a thing as “extension” in Linux, thus that . is a real . and not the separator between file name and extension (as in MS-DOS). And yes, in ASCII, a Space (x’20’) comes before a . (x’2E’).

Oh yes, and please understand why the --sort=version may satisfy your needs in this case. It is because it uses an algorithm that takes the . as a separator between a (package, program, …?) name and it’s version (and sub version). Which might not always give the results you hope for.