Char removed from File name in long list

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

Moderators: XnTriq, helmut, xnview

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

Re: Char removed from File name in long list

Post by cday »

That's the 'Windows' sort order and I'm surprised that it is being used, I'll think about that later...

Is not acceptable to renumber the files by 'padding' the page numbers so that 1 becomes 001, which would overcome the problem? You could easily add a line in your batch file before the creation of the output file to do that...

If not, you could renumber the files if you were working a copy of the originals, but that isn't practical from what you've said?
RobertoG
Posts: 21
Joined: Mon Apr 04, 2016 8:51 am

Re: Char removed from File name in long list

Post by RobertoG »

Hi
at the end, i generate a script to copy and rename all file, with padding...
It took all night, and i'm starting processing now in the simpler way

roberto
cday
XnThusiast
Posts: 4185
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Char removed from File name in long list

Post by cday »

RobertoG wrote:at the end, i generate a script to copy and rename all file, with padding...
It took all night, and i'm starting processing now in the simpler way
I've been trying that too -- using Bulk Rename Command (the command line verion of Batch Rename Utility) -- but I've just confirmed that the sort order problem arises with that too, so the files are still read and renamed in the 'Windows' sort order which will put the pages in the wrong order... :(

So you have a solution that works? :D

Could you post your code? :D :D
RobertoG
Posts: 21
Joined: Mon Apr 04, 2016 8:51 am

Re: Char removed from File name in long list

Post by RobertoG »

well...
copy + Excel formulas slution...

i copied all files :(

If file contains "_P", i generate

Code: Select all

ren 00222_00042_6001\1001011834_P1.tif 1001011834_P001.tif
ren 00222_00042_6001\1001011834_P2.tif 1001011834_P002.tif
ren 00222_00042_6001\1001011834_P3.tif 1001011834_P003.tif
ren 00222_00042_6001\1001011834_P4.tif 1001011834_P004.tif
ren 00222_00042_6001\1001011834_P5.tif 1001011834_P005.tif
ren 00222_00042_6001\1001011834_P6.tif 1001011834_P006.tif
ren 00222_00042_6001\1001011834_P7.tif 1001011834_P007.tif
ren 00222_00042_6001\1001011834_P8.tif 1001011834_P008.tif
...
...

that permit me to use

Code: Select all

\nconvert.exe -out pdf -multi -quiet -D -overwrite -c 1  -o 1001011834.pdf 1001011834_P*
SURELY it can be done better than this, but i'm going after deadline day
cday
XnThusiast
Posts: 4185
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Char removed from File name in long list

Post by cday »

RobertoG wrote:SURELY it can be done better than this, but i'm going after deadline day
PowerShell has the same issue but this thread suggests ways to obtain natural sort order, if you can understand it... :wink:

With that code enabled you could probably just use NConvert with these inputs:

Code: Select all

... 100912594*.tif 100915388*.tif 100920148*.tif
But NConvert run on Linux bash might be expected to use natural sort order (or at least provide an option to use it) so that could simplify things: you could install Cygwin and run bash using that, although it wouldn't be an ideal solution.

You may have heard that MicroSoft announced last week that native Linux bash would be incorporated into Windows 10 in the 'Anniversary Update' this summer, that could be a very significant development for running scripts in Windows... :D