Date sorting #229
-
|
Hey, I assume I've missed this in the docs, but I try to figure out if this is possible: In my folder I have files named with a date prefix in their name like "2025-08-15 blalbala" and files without a prefix. Now I want the files sorted with the "dated-prefixed" files first, descending, followed by the files w/o a prefix. Here the order doesn't really matter as long as they are sorted either a-z or z-a Within the same date, no special order would be required, but if possible it would be nice to know how as well ;) Example 2025-08-01 Title A Is this possible? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Hi @floerio the approach is to group the files based on their name, matching a pattern or not. Step 1: define the first group of items ---
sorting-spec: |
\[yyyy-mm-dd] ...
---this will put the files and subfolders (with names starting with dates in the specified format) first, the other items will follow. Step 2: Specify the desired sorting order for the first group. ---
sorting-spec: |
\[yyyy-mm-dd] ...
> a-z
---The specified order is descending alphabetical, which will put the oldest dates first. Note the additional indentation, which indicates that the order is specified for the group, not for the entire parent folder. The files and subfolders not in the group (no date prefix in title) will be put below the explicitly defined group and sorted with default order (ascending alphabetical), unless you specify one. You can, for example define a sorting order for the entire (parent) folder and it will be applied to the items with no date prefix in title ---
sorting-spec: |
sorting: ui selected
\[yyyy-mm-dd] ...
> a-z
---The above sorting specification example adds the sorting at the (parent) folder level. Note that there is no additional indentation, which tells the engine to apply the sorting to the (parent) folder, not to the items in the defined group. |
Beta Was this translation helpful? Give feedback.
-
|
Ah! Thanks for your explanation - now it works! :-) |
Beta Was this translation helpful? Give feedback.
Hi @floerio
the approach is to group the files based on their name, matching a pattern or not.
Technically, this can be simplified even more by defining only the first group, 'items (files, subfolders) which name starts with a date'. Items not matching will be put below the matching ones.
Step 1: define the first group of items
this will put the files and subfolders (with names starting with dates in the specified format) first, the other items will follow.
No explicit sorting specified implies the default one, which is ascending alphabetical.
Step 2: Specify the desired sorting order for the first group.