Using v3.19 and tested with same (bad) results on v3.19c
When I sort by Full Filename (the full filename: drive, directory, filename, and extension) it appears that the sort is case insensitive and some characters (the hyphen (dash, "-") being at least one of them) is ignored.
In my pictured example below, I have loaded two albums. Each album is in a directory based on the album name. The album names are "Boingo" and "Boi-Ngo". When I sort by Filename, the albums are mixed together as-if the tracks are in the same directory.
I have tried sorting by other fields, then re-sorting by filename and reverse sorting by filename. In all cases, the filename sort appears to be ignoring the case and the hyphen in the directory name.
I can understand sorting in a case-insensitive manner on just the filename portion of the full path. However, I would expect files from different directories to be sorted/grouped separately.
As a work-around, I was able to replace the "Full Filename" column with two columns, "Path" and "Filename". I can then sort by "Filename" (first), then "Path". This orders the list as expected.
To me it looks like the sorting starts at the end - which means that first the filenames get sorted and then the path-component.
If you split the information and sort in 2 steps, then the pre-sorted list from the first list is taken.
The example only has the two albums (directories), so I can see how that would appear to be the case based on the limited example. However, if I have several album directories loaded, they are all sorted as expected, except these two that get jumbled-up together.
Note: I also tried using various "Sort by" patterns, but as soon as I include %_filename% or %_filename_ext%, the two album directories get sorted together. I tried doing $trim() and $lower() on the filename ... hoping that the use of a function would prevent the problem, but, I still got the same original (bad) results.
I moved this from "Support" to "Bug Reports" as I think this may be a bug.
I am attempting to have a single column that will sort based on the full file name path. I have tried using %_path% and the various path components (%_folderpath%, %_filename_ext%, %_filename%, and %_extensions%). I tried performing a function on the fields (e.g., $lower() and $trim()); however, I still ended up with the unexpected results.
The problem is that as soon as I include the file name (via %_path%, %_filename_ext%, or %_filename% fields) in the sort by criteria, my list of files is sorted by the %_folderpath% in a case-insensitive manner and, it seems, some special characters (specifically the hypen, "-") are removed before the sort. This results in the following (abbreviated) list where the files from different directories are sorted together:
C:\Music\Oingo Boingo\Boi-Ngo\01 - Home Again.m4a
C:\Music\Oingo Boingo\Boingo\01 - Insanity.m4a
C:\Music\Oingo Boingo\Boingo\02 - Hey!.m4a
C:\Music\Oingo Boingo\Boi-Ngo\02 - Where Do All My Friends Go.m4a
C:\Music\Oingo Boingo\Boi-Ngo\03 - Elevator Man.m4a
C:\Music\Oingo Boingo\Boingo\03 - Mary.m4a
C:\Music\Oingo Boingo\Boingo\04 - Can't See (Useless).m4a
C:\Music\Oingo Boingo\Boi-Ngo\04 - New Generation.m4a
The work-around is to use two column, one for just %_folderpath% and the other for %_filename_ext%. Sorting on the filename, then folder path produces the expected results ... all files are effectively sorted first by the folder path, then within the folder path, sorted by the filename and extension. By using both columns, my list is sorted as expected, with the files from one directory in order, followed by the files from the other directory (in order):
C:\Music\Oingo Boingo\Boi-Ngo\01 - Home Again.m4a
C:\Music\Oingo Boingo\Boi-Ngo\02 - Where Do All My Friends Go.m4a
C:\Music\Oingo Boingo\Boi-Ngo\03 - Elevator Man.m4a
C:\Music\Oingo Boingo\Boi-Ngo\04 - New Generation.m4a
C:\Music\Oingo Boingo\Boingo\01 - Insanity.m4a
C:\Music\Oingo Boingo\Boingo\02 - Hey!.m4a
C:\Music\Oingo Boingo\Boingo\03 - Mary.m4a
C:\Music\Oingo Boingo\Boingo\04 - Can't See (Useless).m4a
I do not think that the hyphen gets ignored.
I think that first all the filenames get sorted (that is why you have all the same numbers adjacent to each other) and then the _DIRECTORY is sorted.
For test purposes I copied a folder (Impromptu) and then added a hyphen (Improm-ptu) and sorted by a column with just _PATH as field.
The result looks like yours.
This is, what I get with a different column definition:
Exactly as you say: if the filename is included in the sort criteria, then that gets sorted first.
This is a speciality of some Windows sorting algorithms, which employ something called word sort technique.
In this type of sort, all punctuation marks and other non-alphanumeric characters, except for the hyphen and the apostrophe, come before any alphanumeric character. The hyphen and the apostrophe are treated differently from the other non-alphanumeric characters to ensure that words such as "Boi-Ngo" and "Boingo" stay together in a sorted list.
You can see this live in action by creating a list of folders in Windows Explorer:
Boi-Ago
Boi-Ngo
Boiago
Boingo
Usually, you'd expect the list of folders sorted like above. But the special word sort technique outlined above produces the following result, which also matches what you've observed in your initial report.
Boiago
Boi-Ago
Boingo
Boi-Ngo
I can understand why you'd see this type of sorting behavior as a bug, but hope that the additional information reframes it more in the direction of a feature — a feature, which is admittedly not very helpful in your particular case.
In my case, it is more important to have the files sorted by the literal value vs the word sort technique.
With this in mind, I replaced hyphens ("-") with asterisks ("*") in the %_path%. This sorted my list as I expected. Because the asterisk is not a valid path name, this technique preserves the uniqueness of the path. In other words, The directory "Boi-Ngo" will be converted to "Boi*Ngo". Because a directory name cannot contain an asterisk, I will never, ever, have a directory actually named "Boi*Ngo" and so will never risk "Boi-Ngo" being sorted together with "Boi*Ngo".
From your reply, it sounds like I there may be other characters that may cause this same sorting problem. I will have to be on the watch for those conditions and will simply pick another invalid path character to use as a replacement.
For those interested, my "Sort by" expression is $replace(%_path%,-,*) as pictured below:
Thank you all for your help. Using the above expression resolves my current problem and I have a few more invalid path characters I can use should I find other characters that cause the problem.