Closed Pentaquark1 closed 1 year ago
In my experience, the implementation of file managers' sort by name differs; hence, I prefer the YYYY-MM-DD pattern with leading zero to pad the month or/and day if necessary.
With synthetic data in an instance of Linux Debian 13/trixie, the following is the sort as provided by thunar (version 4.18.7):
The next one is by vifm (version 0.12); the explicit commands are :sort
, confirmation (by enter/return), followed either by a n
(case sensitive) or N
(case agnostic) sort by file name:
(With commands :vs
and :vs!
, one can toggle in the later between the two pane / Norton Commander like style and single pane display.)
Hi @Pentaquark1 ,
https://en.wikipedia.org/wiki/ISO_8601
Each date and time value has a fixed number of digits that must be padded with leading zeros.
I try to stick as closely as possible to the basic ISO definitions. Not only because of the fact that dashes could be omitted in a shorter version (2023-10-27 = 20231027), leading zeros are a must in many use-cases. Furthermore, sort order is depending on the tool you're using. AFAIR all of my tools do not respect missing leading zeros.
Therefore, I won't change the regex in my projects to allow omitted leading zeros for ISO datestams, sorry.
Hi @novoid , could you name some of those use-cases? Trying to decide if I should bother migrating the timestamps to ISO still.
could you name some of those use-cases?
My file management does not only rely on move2archive. It's a whole ecosystem of scripts and methods described on https://karl-voit.at/managing-digital-photographs/
Getting the right order in all sorts of tools (and not just a few that do seem to have extra routines handling the order differently) is an important aspect. Most important to me is the zsh, Thunar and dired.
vk@sting ~2d/2023-10-29-order % touch "2023-1-1" "2023-01-01" "2023-11-11" "2023-2-2" "2023-02-02"
vk@sting ~2d/2023-10-29-order % l
total 36
drwxr-xr-x 2 vk vk 4096 Oct 29 15:26 ./
drwxr-xr-x 59 vk vk 28672 Oct 29 15:26 ../
-rw-r--r-- 1 vk vk 0 Oct 29 15:26 2023-01-01
-rw-r--r-- 1 vk vk 0 Oct 29 15:26 2023-02-02
-rw-r--r-- 1 vk vk 0 Oct 29 15:26 2023-1-1
-rw-r--r-- 1 vk vk 0 Oct 29 15:26 2023-11-11
-rw-r--r-- 1 vk vk 0 Oct 29 15:26 2023-2-2
vk@sting ~2d/2023-10-29-order % alias l
l='ls -l --all --classify --color=auto'
vk@sting ~2d/2023-10-29-order %
Short backstory, I saw your suggestion of the organize tool. It seems pretty powerful, but one side effect was that I ended up with a lot of files in a format like YYYY-M-D, where the leading 0 is dropped for month or day. It doesn't seem to effect sorting of the files in any way so I don't really mind. I changed the regexp in my local move2arch like this to allow it to parse those formats too: \d\d\d\d-[01]\d-[0123]\d -> \d\d\d\d-[01]?\d-[0123]?\d