Renumbering files

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

Moderators: XnTriq, xnview

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

Renumbering files

Postby cday » Mon Mar 27, 2017 8:37 pm

The following option was recently added to NConvert to enable files to be renumbered:

Code: Select all

-n start end step : Begin End Step (for image sequence)

If I use the following code to renumber four input files 01L 01R 02L 02R :

Code: Select all

nconvert -n 1 4 1 -out jpeg -o Output\###.jpg Input\*.jpg

Expected result: the files are renumbered to 001 002 003 004

Actual result:

Code: Select all

Conversion of Input\01L.jpg into Output\001.jpg OK
Conversion of Input\01L.jpg into Output\002.jpg OK
Conversion of Input\01L.jpg into Output\003.jpg OK
Conversion of Input\01L.jpg into Output\004.jpg OK
Conversion of Input\01R.jpg into Output\001_1.jpg OK
Conversion of Input\01R.jpg into Output\002_1.jpg OK
Conversion of Input\01R.jpg into Output\003_1.jpg OK
Conversion of Input\01R.jpg into Output\004_1.jpg OK
Conversion of Input\02L.jpg into Output\001_2.jpg OK
Conversion of Input\02L.jpg into Output\002_2.jpg OK
Conversion of Input\02L.jpg into Output\003_2.jpg OK
Conversion of Input\02L.jpg into Output\004_2.jpg OK
Conversion of Input\02R.jpg into Output\001_3.jpg OK
Conversion of Input\02R.jpg into Output\002_3.jpg OK
Conversion of Input\02R.jpg into Output\003_3.jpg OK
Conversion of Input\02R.jpg into Output\004_3.jpg OK

Each input file is renumbered four times instead of once...

Am I misunderstanding the intended use of the option, or is this a bug?

User avatar
xnview
Author of XnView
Posts: 27352
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Renumbering files

Postby xnview » Mon Mar 27, 2017 11:31 pm

-n was not recently added :)
you need to use

Code: Select all

nconvert -n 1 4 1 -out jpeg -o Output\###.jpg Input\###.jpg
Pierre.

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

Re: Renumbering files

Postby cday » Tue Mar 28, 2017 3:14 pm

xnview wrote:-n was not recently added :)

You are right :D

But I'm confused because I clearly recall an existing option being modified within the last year or two to add, I think, a step parameter, but I can't find any reference to that now.

xnview wrote:you need to use

Code: Select all

nconvert -n 1 4 1 -out jpeg -o Output\###.jpg Input\###.jpg

I tried that code and many variations, but couldn't get the expected renumbering... :(

I don't know if the renumbering option could possibly only work for a filelist input, for example??

BTW in testing older NConvert versions, I believe I saw different results in recent versions compared with earlier versions, but as none actually worked I didn't stop to record the actual outputs. I mention it in case the issue arises in the future in another thread.

I finally found the following using NConvert without the -n option works:

Code: Select all

nconvert -o Output\###.jpg Input\*.jpg

As my immediate need is to renumber files sequentially incremented by one using simple code, that one-line solution meets my needs very well! Thanks for giving us NConvert! :D

User avatar
XnTriq
Moderator & Librarian
Posts: 4917
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Renumbering files

Postby XnTriq » Tue Mar 28, 2017 8:45 pm

Related topics (for future reference):

WhatsNew.txt wrote:XnView v2.37 (LIBFORMAT v6.92) 10/11/2016:
* NConvert: Multipage extract - viewtopic.php?f=57&t=33879

XnView v2.36 (LIBFORMAT v6.88) 04/29/2016:
* NConvert: -t start step for number in output name

XnView v2.34 (LIBFORMAT v6.80) 07/09/2015:
* NConvert # in filename - viewtopic.php?f=57&t=31992&p=127142


Return to “NConvert”

Who is online

Users browsing this forum: No registered users and 1 guest