Sorting by date, files or dirs with same date and time: use creation date as a second sort criteria

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Sorting by date, files or dirs with same date and time: use creation date as a second sort criteria

Post by *DrShark »

Use case:

In Total Commander, on some file "name.txt" press Ctrl+C, then Ctrl+V:

Explorer copy merthod will be used, and a new copy of the file in the same locatiion will be created with the same modification (aka write) date/time but with different name, "name - copy.txt".

If we use descending sorting by Date column in default Total Commander view mode, which sorts files by a modification date/time, we'll see files sorted as follows:

name.txt
name - copy.txt

so the newer file "name - copy.txt" is lower then older "name.txt", which is not quite expected since we're sorting by date.
It seems TC is using file name as a second sort criteria when the modification date is the same.
I suggest to use additional available file dates as next sorting criterias if modification date-time of files is the same, e.g.:

* modification dates of different files are the same -> sort by creation date;

* both modification date and creation dates match -> sort by access date;

* if all these kinds of dates the same, then apply sorting by name.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
Hacker
Moderator
Moderator
Posts: 13052
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Re: Sorting by date, files or dirs with same date and time: use creation date as a second sort criteria

Post by *Hacker »

For anyone who might be looking for such functionality using a workaround, this can be achieved using custom columns.

HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Re: Sorting by date, files or dirs with same date and time: use creation date as a second sort criteria

Post by *Usher »

2DrShark
It seems to be more complicated than you think.

1. I think that TC doesn't use additional sort by name. It's NTFS driver that orders MFT entries. You should make tests also on FAT32 partition. I expect that the files with the same timestamps are unsorted.
2. Different Windows versions may use different naming conventions for copies.
3. Sort order may be different for full view and filtered views.

Now it's time for my tests in Windows XP:
1. Created test directory "NTFS" on NTFS partition (left column on listings) and FAT32 on FAT32 partition (right column on listings)
2. Copied file "Desktop.ini"
3. Copied file "bing2012.ico"
4. Copied directory "1test"
5. Created directory "2test"

Note: Using dir command you should see that NTFS driver sort files and directories by name, FAT32 keeps names unsorted:

Code: Select all

c:\TCst\NTFS>dir                                            e:\FAT32>dir
 Katalog: c:\TCst\NTFS                                       Katalog: e:\FAT32

2021-07-04  01:26    <DIR>          .                       2021-07-04  02:08    <DIR>          .
2021-07-04  01:26    <DIR>          ..                      2021-07-04  02:08    <DIR>          ..
2016-06-01  01:26    <DIR>          1test                   2016-06-02  15:32                82 Desktop.ini
2021-07-04  01:26    <DIR>          2test                   2012-09-02  01:32               894 bing2012.ico
2012-09-02  01:32               894 bing2012.ico            2016-06-01  01:26    <DIR>          1test
2016-06-02  15:32                82 Desktop.ini             2021-07-04  01:27    <DIR>          2test
               2 plik(ów)             976 bajtów                           2 plik(ów)             976 bajtów
               4 katalog(ów)                                               4 katalog(ów)
6. Copied Desktop.ini to Zesktop.ini with Shift+F5
7. Copied Zesktop.ini to "Kopia Zesktop.ini" with Ctrl+C - Ctrl+V

Now watch dir magic (ordered by date):

Code: Select all

c:\TCst\NTFS>dir /o-d                                       e:\FAT32>dir /o-d
 Katalog: c:\TCst\NTFS                                       Katalog: e:\FAT32

2021-07-04  01:28    <DIR>          ..                      2021-07-04  02:08    <DIR>          ..
2021-07-04  01:28    <DIR>          .                       2021-07-04  02:08    <DIR>          .
2021-07-04  01:26    <DIR>          2test                   2021-07-04  01:27    <DIR>          2test
2016-06-02  15:32                82 Zesktop.ini             2016-06-02  15:32                82 Zesktop.ini
2016-06-02  15:32                82 Desktop.ini             2016-06-02  15:32                82 Kopia Zesktop.ini
2016-06-02  15:32                82 Kopia Zesktop.ini       2016-06-02  15:32                82 Desktop.ini
2016-06-01  01:26    <DIR>          1test                   2016-06-01  01:26    <DIR>          1test
2012-09-02  01:32               894 bing2012.ico            2012-09-02  01:32               894 bing2012.ico
               4 plik(ów)           1 140 bajtów                           4 plik(ów)           1 140 bajtów
               4 katalog(ów)                                               4 katalog(ów)
Ordered by date and filtered:

Code: Select all

c:\TCst\NTFS>dir /o-d *.ini                                 e:\FAT32>dir /o-d *.ini
 Katalog: c:\TCst\NTFS                                       Katalog: e:\FAT32

2016-06-02  15:32                82 Kopia Zesktop.ini       2016-06-02  15:32                82 Zesktop.ini
2016-06-02  15:32                82 Zesktop.ini             2016-06-02  15:32                82 Kopia Zesktop.ini
2016-06-02  15:32                82 Desktop.ini             2016-06-02  15:32                82 Desktop.ini
               3 plik(ów)             246 bajtów                           3 plik(ów)             246 bajtów
               0 katalog(ów)                                               0 katalog(ów)
Can you see different order for full and filtered listing?

8. Copied Desktop.ini to "Kopia Desktop.ini" with Ctrl+C - Ctrl+V

And the magic goes more mighty. Ordered by date:

Code: Select all

c:\TCst\NTFS>dir /o-d                                       e:\FAT32>dir /o-d
 Katalog: c:\TCst\NTFS                                       Katalog: e:\FAT32

2021-07-04  01:29    <DIR>          ..                      2021-07-04  02:08    <DIR>          ..
2021-07-04  01:29    <DIR>          .                       2021-07-04  02:08    <DIR>          .
2021-07-04  01:26    <DIR>          2test                   2021-07-04  01:27    <DIR>          2test
2016-06-02  15:32                82 Kopia Zesktop.ini       2016-06-02  15:32                82 Kopia Desktop.ini
2016-06-02  15:32                82 Zesktop.ini             2016-06-02  15:32                82 Kopia Zesktop.ini
2016-06-02  15:32                82 Desktop.ini             2016-06-02  15:32                82 Desktop.ini
2016-06-02  15:32                82 Kopia Desktop.ini       2016-06-02  15:32                82 Zesktop.ini
2016-06-01  01:26    <DIR>          1test                   2016-06-01  01:26    <DIR>          1test
2012-09-02  01:32               894 bing2012.ico            2012-09-02  01:32               894 bing2012.ico
               5 plik(ów)           1 222 bajtów                           5 plik(ów)           1 222 bajtów
               4 katalog(ów)                                               4 katalog(ów)
Ordered by date and filtered:

Code: Select all

c:\TCst\NTFS>dir /o-d *.ini                                 e:\FAT32>dir /o-d *.ini
 Katalog: c:\TCst\NTFS                                       Katalog: e:\FAT32

2016-06-02  15:32                82 Kopia Desktop.ini       2016-06-02  15:32                82 Zesktop.ini
2016-06-02  15:32                82 Kopia Zesktop.ini       2016-06-02  15:32                82 Kopia Zesktop.ini
2016-06-02  15:32                82 Zesktop.ini             2016-06-02  15:32                82 Kopia Desktop.ini
2016-06-02  15:32                82 Desktop.ini             2016-06-02  15:32                82 Desktop.ini
               4 plik(ów)             328 bajtów                           4 plik(ów)             328 bajtów
               0 katalog(ów)                                               0 katalog(ów)
Unsorted:

Code: Select all

c:\TCst\NTFS>dir                                            e:\FAT32>dir
 Katalog: c:\TCst\NTFS                                       Katalog: e:\FAT32

2021-07-04  01:29    <DIR>          .                       2021-07-04  02:08    <DIR>          .
2021-07-04  01:29    <DIR>          ..                      2021-07-04  02:08    <DIR>          ..
2016-06-01  01:26    <DIR>          1test                   2016-06-02  15:32                82 Desktop.ini
2021-07-04  01:26    <DIR>          2test                   2012-09-02  01:32               894 bing2012.ico
2012-09-02  01:32               894 bing2012.ico            2016-06-01  01:26    <DIR>          1test
2016-06-02  15:32                82 Desktop.ini             2021-07-04  01:27    <DIR>          2test
2016-06-02  15:32                82 Kopia Desktop.ini       2016-06-02  15:32                82 Zesktop.ini
2016-06-02  15:32                82 Kopia Zesktop.ini       2016-06-02  15:32                82 Kopia Zesktop.ini
2016-06-02  15:32                82 Zesktop.ini             2016-06-02  15:32                82 Kopia Desktop.ini
               5 plik(ów)           1 222 bajtów                           5 plik(ów)           1 222 bajtów
               4 katalog(ów)                                               4 katalog(ów)
Note that FAT32 keeps unsorted order for full and filtered list. However, that unsorted order will change in the future if I start new manipulations with file names. It's enough to rename any file/dir using longer name…

As you can see, there is already disorder in the system. Do you really want to create more mess? MS programmers have already started, see the topic Display of Parent Directory Date
Andrzej P. Wozniak
Polish subforum moderator
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Re: Sorting by date, files or dirs with same date and time: use creation date as a second sort criteria

Post by *DrShark »

Usher wrote: 2021-07-04, 02:27 UTC It seems to be more complicated than you think.

1. I think that TC doesn't use additional sort by name. It's NTFS driver that orders MFT entries. You should make tests also on FAT32 partition. I expect that the files with the same timestamps are unsorted.

[...]

As you can see, there is already disorder in the system. Do you really want to create more mess?
Well, even if the order of files in filesystems is messy, my suggestion is about TC behavior where I expect files so be sorted from newer to older (or opposite) if sort goes by Date column, and not using other criterias be it alphabet order or an order provided by filesystems etc. - I expect such criterias to be used only when all kinds of dates of the file match.

Actually I suspect TC uses ONLY write date-time when sorting by Date column mainly for speed reasons, but it would be nice to have an option to use all kinds of dates as factors for sorting by default Date column. Custom columns could be used to achieve that kind of sorting, but I wouldn't call it a good workaround because most of the time I use default columns view with sort by Date in it...
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
Post Reply