Prepend Sync filenames with a '0' when there are more than 9 files

The checkbox Prefix file names with number in the Sync with External Folder window is obviously meant to keep the chapter order in the external folder intact.
This does not work anymore when there are more than nine chapters because of the way filenames are sorted and displayed on most OS (ASCII sort).


1 Chapter1-1-.txt 10 Chapter10-10-.txt 11 Chapter11-11-.txt 12 Chapter12-12-.txt 2 Chapter2-2-.txt 3 Chapter3-3-.txt etc.

The easiest workaround is to prepend with a leading zero because 0=48 < 1=49, leading to:

01 Chapter1-1-.txt 02 Chapter2-2-.txt 03 Chapter3-3-.txt 10 Chapter10-10-.txt 11 Chapter11-11-.txt 12 Chapter12-12-.txt etc.

$filename = (count($files) > 9 && current_file < 10) ? '0' . $filename : $filename;

(Certainly there is a smarter snippet that isn’t limited to two digits.)

The Mac version already does this, so perhaps it will be in the next Windows version? Works with 1000s of files, too.

I have the feeling that this possibility is built into recent versions of the Mac system; perhaps it’s not inbuilt in Windows and the Window-guys will have to roll their own?



What do you mean “roll their own”?

The actual operating system used to edit the text files must not matter. Yes, there may be ways to turn “intuitive numbering” on or off in certain OS and explorer applications, but that does not solve the core problem. E. g. I am using the Caret editor on Chrome OS and Sublime Text on Mint to edit the files, and both sort files the traditional way in their project file explorer.

A year has passed.