I have a program, written with net471
and uses Directory.GetFiles
.
Now we want to convert it to .NET Core and run it on Linux.
When we do this, we get a different order of files.
I know what the docs say:
The order of the returned file names is not guaranteed
But until we moved to Linux, files were fixed order.
We want to keep this order, do we need to write a comparer ourselves, or does one already exist?
Rules:
- Underscore after without:
file.txt -> file_en.txt
. - Name with number after without:
file.txt -> file1.txt
- Number before Underscore:
file1.txt -> file_en.txt
- Alphabetical numbers:
10.txt -> 3.txt
- Ignore case:
AA.txt -> ab.txt -> ZZ.txt
If there is a comparer for that, we need it to be an OS agnostic.