Natural Order sorting of files names in file explorer

Steps to reproduce

Create daily notes between the first day of the month and the tenth day of the month.

Expected result

2020-06-1
2020-06-2
2020-06-3
2020-06-4
2020-06-5
2020-06-6
2020-06-7
2020-06-8
2020-06-9
2020-06-10
2020-06-11

Actual result

2020-06-1
2020-06-10
2020-06-11
2020-06-2
2020-06-3
2020-06-4
2020-06-5
2020-06-6
2020-06-7
2020-06-8
2020-06-9

Environment

  • Operating system: macOS 10.15.4
  • Obsidian version: 0.6.7
  • Using custom CSS: no

Additional information

Screen Shot 2020-06-12 at 2.31.22 PM

8 Likes

This is not a bug really. It’s the way filenames (strings) are sorted.
I suggest you use 2020-06-01

2 Likes

Yes, by default strings are sorted this way. But most UIs use natural order sorting of strings so when numbers are used in filenames they are sorted in numeric order. This is to be more human-friendly than machine friendly :smiley:

Here’s an article on the subject by the Co-founder of Stack Overflow and Discourse:

2 Likes

Thanks, I will move this to feature request.

3 Likes

Yes, meanwhile it’s good to learn to use the double-digit system for the first nine numbers as MacOSX and other file browsers also do the same thing. That’s how life is.

In HTML there is an operator called sortan, which stands for sort alphanumerically. Could that be used in markdown?

That is most assuredly not the case on macOS.

1 Like

I would love to see this changed as I have many notes and folders that have 1-9, and beyond. And I’m unlikely to change my habit going forward…

Further info for reference - the current sort order is Lexicographic/lexical sorting. Whereas, as OP mentioned, we’re interested in a natural/numerical sort, which Windows (and most applications, including VS Code which seems to be Obsidian’s biggest competitor) uses.

1 Like

is there any new news on this? I’m really struggling to rename all numbering - ie: 1 to 01 and so on. I understand strings are not sorted in arithmetic order but as a naive user I expect to see 11 to be sorted right after 10 in the file name prefix…

It appears that they labeled the post “Valuable” so that must mean it is a near-term priority

@nixsee no. this just a tag used to search\categorize feature requests. No near term priority.

1 Like

The Alphanum algorithm is a pattern I’ve used in the past in similar situations: http://davekoelle.com/alphanum.html

3 Likes

Definitely would love to see alphanum sort order. If you use a Luhmann-style numbering system that uses serial proximity to denote strong connections, you end up having to use UUIDs with a ton of unnecessary zeros in order to reduce the possibility of running out of space between notes (e.g. 008a01c03).

2 Likes

Putting in my vote for this feature as well. I use an addressing scheme similar to Luhmann’s, e.g. “x.x.x.x” and it helps immensely to have, for instance, “2." items precede "10.” items (similar to how Finder / Windows Explorer / Zettlr sort them)

This wil be implemented in an upcoming release.