Read input files in natural sort order?

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

Moderators: helmut, XnTriq, xnview

Read input files in natural sort order?

Postby cday » Wed Apr 06, 2016 9:44 am

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.]
cday
XnThusiast
 
Posts: 1336
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Read input files in natural sort order?

Postby xnview » Wed Apr 06, 2016 12:37 pm

i don't know :(
Pierre.
User avatar
xnview
Author of XnView
 
Posts: 26833
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Read input files in natural sort order?

Postby Mixer » Wed Apr 06, 2016 2:13 pm

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?
Mixer
 
Posts: 166
Joined: Fri Aug 28, 2015 6:24 am

Re: Read input files in natural sort order?

Postby cday » Wed Apr 06, 2016 2:24 pm

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...
cday
XnThusiast
 
Posts: 1336
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Read input files in natural sort order?

Postby Mixer » Wed Apr 06, 2016 2:54 pm

With Explorer (just checked it in 10) you already have numeric sorting which you can revert to old-school http://superuser.com/questions/536438/weird-directory-sort-order. With Nconvert I have no idea what it does and how it works.
Mixer
 
Posts: 166
Joined: Fri Aug 28, 2015 6:24 am

Re: Read input files in natural sort order?

Postby cday » Wed Apr 06, 2016 4:07 pm

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/weird-directory-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.
cday
XnThusiast
 
Posts: 1336
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Read input files in natural sort order?

Postby xnview » Thu Apr 07, 2016 11:47 am

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/weird-directory-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.
User avatar
xnview
Author of XnView
 
Posts: 26833
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Read input files in natural sort order?

Postby cday » Thu Apr 07, 2016 11:59 am

xnview wrote:it's the arguments order from cmd

And PowerShell seems to be the same, unless there's a switch for that?
cday
XnThusiast
 
Posts: 1336
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.


Return to NConvert

Who is online

Users browsing this forum: No registered users and 2 guests