Read input files in natural sort order?

Discussions on NConvert - the command line tool for image conversion and manipulation

Moderators: XnTriq, helmut, xnview

Post Reply
cday
XnThusiast
Posts: 3985
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Read input files in natural sort order?

Post by cday »

Pierre (or anyone else...) is there a way to read input files in natural sort order rather than the 'Windows' sort order?

When a multi-page file is created from files 1.tif 2.tif 3.tif ... 10.tif 11.tif ..., the pages are in the order 1, 10, 11...

Code: Select all

nconvert -out pdf -multi -o name.pdf *.tif
[When renumbering the files to 001.tif 002.tif 003.tif ... isn't an option.]
User avatar
xnview
Author of XnView
Posts: 43596
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Read input files in natural sort order?

Post by xnview »

i don't know :(
Pierre.
Mixer
Banned
Posts: 166
Joined: Fri Aug 28, 2015 6:24 am

Re: Read input files in natural sort order?

Post by Mixer »

cday wrote:Pierre (or anyone else...) is there a way to read input files in natural sort order rather than the 'Windows' sort order?
If you had to sort strings "aaa", "aab", "aaab", "aac", "aaac", "aaad", "aad", "aaaa" in natural order, what order would it be?
cday
XnThusiast
Posts: 3985
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Read input files in natural sort order?

Post by cday »

Mixer wrote:
cday wrote:Pierre (or anyone else...) is there a way to read input files in natural sort order rather than the 'Windows' sort order?
If you had to sort strings "aaa", "aab", "aaab", "aac", "aaac", "aaad", "aad", "aaaa" in natural order, what order would it be?
I'd have to think about that!

But the immediate problem only relates to reading numeric input files in natural numerical order, whereas NConvert (and cmd.exe generally seemingly...) reads them in the 'Windows' sort order: the result is that some pages in the multi-page PDF created are in the wrong order... :(

Renumbering the input files is the obvious solution, but RobertoG in his thread says he can't do that...
Mixer
Banned
Posts: 166
Joined: Fri Aug 28, 2015 6:24 am

Re: Read input files in natural sort order?

Post by Mixer »

With Explorer (just checked it in 10) you already have numeric sorting which you can revert to old-school http://superuser.com/questions/536438/w ... sort-order. With Nconvert I have no idea what it does and how it works.
cday
XnThusiast
Posts: 3985
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Read input files in natural sort order?

Post by cday »

Mixer wrote:With Explorer (just checked it in 10) you already have numeric sorting which you can revert to old-school http://superuser.com/questions/536438/w ... sort-order. With Nconvert I have no idea what it does and how it works.
I suspect from a quick Google earlier that NConvert run using cmd.exe users cmd.exe sort order, which seems to be the 'Windows' 1, 10, 11 order.
User avatar
xnview
Author of XnView
Posts: 43596
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Read input files in natural sort order?

Post by xnview »

cday wrote:
Mixer wrote:With Explorer (just checked it in 10) you already have numeric sorting which you can revert to old-school http://superuser.com/questions/536438/w ... sort-order. With Nconvert I have no idea what it does and how it works.
I suspect from a quick Google earlier that NConvert run using cmd.exe users cmd.exe sort order, which seems to be the 'Windows' 1, 10, 11 order.
it's the arguments order from cmd
Pierre.
cday
XnThusiast
Posts: 3985
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Read input files in natural sort order?

Post by cday »

xnview wrote:it's the arguments order from cmd
And PowerShell seems to be the same, unless there's a switch for that?
Post Reply