Timeline for What naming convention can I use to ensure that file names sort in a consistent order using ls?
Current License: CC BY-SA 4.0
17 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 8, 2022 at 19:55 | comment | added | Arkadiusz Drabczyk | @Michael: you may just an environment variable | |
| Feb 8, 2022 at 18:17 | comment | added | Michael | @ArkadiuszDrabczyk It seems if I set LC_COLLATE=POSIX I get the order I expect, although using locale or localectl seems to set it but only for root. (maybe I need to reboot first?) | |
| Feb 8, 2022 at 18:16 | comment | added | Michael | @ArkadiuszDrabczyk At a minimum I would expect "A.jpg" to come before A<anything>.jpg" as this would allow me to come up with a convention by which conflicting file names could have something appended to the name and still come after the older copy. | |
| Feb 8, 2022 at 17:43 | comment | added | Arkadiusz Drabczyk | Can you explain what order would you actually expect from ls? | |
| Feb 8, 2022 at 14:21 | comment | added | U. Windl | It's also locale-dependent. See also: en.wikipedia.org/wiki/Collation#Labeling_of_ordered_items | |
| Feb 8, 2022 at 0:28 | comment | added | Freedo | Why not just make a ls alias | |
| Feb 7, 2022 at 21:27 | answer | added | Andrew C | timeline score: 1 | |
| Feb 7, 2022 at 20:26 | comment | added | Michael | @ArkadiuszDrabczyk I have updated the question to include this information. | |
| Feb 7, 2022 at 20:25 | history | edited | Michael | CC BY-SA 4.0 | added 253 characters in body |
| Feb 7, 2022 at 20:23 | comment | added | Michael | @waltinator the problem is, most files don't have a sequence number. I need some way of coming up with a sequence number after the fact that doesn't get sorted before the original one. | |
| Feb 7, 2022 at 19:47 | comment | added | waltinator | I'd use A_001.jpg, A_002.jpg, etc. Read man seq and man bash about the printf builtin. | |
| Feb 7, 2022 at 18:57 | comment | added | Freedo | Have you seen unix.stackexchange.com/questions/445821/… | |
| Feb 7, 2022 at 18:55 | comment | added | Chris Davies | Related, if not a duplicate, Why does ls list the following files in seemingly different orders? | |
| Feb 7, 2022 at 18:50 | comment | added | Arkadiusz Drabczyk | ... and post output of type -a ls | |
| Feb 7, 2022 at 18:47 | comment | added | Arkadiusz Drabczyk | I get a different order: A-1.jpg A.jpg A1.jpg A_1.jpg which makes more sense. What implementation of ls are you using? What's value of LC_COLLATE? | |
| Feb 7, 2022 at 18:37 | history | edited | Michael | CC BY-SA 4.0 | added 457 characters in body |
| Feb 7, 2022 at 18:23 | history | asked | Michael | CC BY-SA 4.0 |