Output filename parameters

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

Moderators: XnTriq, helmut, xnview

Post Reply
Mixer
Banned
Posts: 166
Joined: Fri Aug 28, 2015 6:24 am

Output filename parameters

Post by Mixer »

'nconvert -help' wrote: -no# : # not used for numeric operator

-o filename : Output filename
Use # to specify position of numeric enumerator
Use % to specify source filename
Use $ to specify full source pathname
Use $$ to specify source folder name
Use $EXIF:DateModified[date format] to specify EXIF date modified
Use $EXIF:DateTaken[date format] to specify EXIF date taken
Hi. While user in this thread http://newsgroup.xnview.com/viewtopic.php?f=57&t=30942 was satisfied, working with files and paths containing nonalphabetical characters in their names might be troublesome. I'd like to propose change in command design for your consideration. Keep -o as key for defining base output filename string. Use another key for aItering base name if needed, -om for example.
Set for this key syntax something like
'-om imaginary syntax' wrote:-om position:modifier[;position:modifier[;position:modifier...]]

positon - position in base filename where modifier must be inserted (if few modifiers share the same target position, precedence goes in order they stand in command string)
modifier - some operator (# for numeric enumerator, % for original filename, $$ for source folder name, "text" for inserting text etc.)
Example:

Code: Select all

nconvert.exe -o "My % cRaZy $ NamEd FiLe #" -om 1:$$;26:#;26:" which once was ";26:% -resize longest 100 "C:\Pictures Directory\original.jpg"
Then if nconvert autoappends \ to the end of source folder name, output would have to be "C:\Pictures Directory\My % cRaZy $ NamEd FiLe #1 which once was original.jpg"

Disadvantage: you have to count position for inserting new parts, command string gets longer and you lose visual simplicity of name changing.
Advantage: you don't have interpretation conflicts in base output filename, any allowed characters may be used and -om may not be used at all if not needed.
I hope you get the idea, implementing it could be done some other way.

I don't propose using reserved characters from this list instead of currently used #%$ because nconvert is crossplatform (or do versions for Win, Mac and Linux differ?), and some of reserved in Windows characters are allowed in filenames in Unix.
User avatar
xnview
Author of XnView
Posts: 43598
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Output filename parameters

Post by xnview »

you would like to use %#$ as output filename?
Pierre.
Mixer
Banned
Posts: 166
Joined: Fri Aug 28, 2015 6:24 am

Re: Output filename parameters

Post by Mixer »

I would like that utility I use did its job quietly without imposing more restrictions on character set for naming files than it is already done by operating system.
If this user here will use -no# option he'll be fine with writing to folders with # in name, but he will lose chance to use numerators in his converting.
By your logic you should add -no$ and -no% options too.
And I will use any of $%# characters whenever I want because I'm not using nconvert. I just sometimes help others with their tasks on altruistic basis.
User avatar
xnview
Author of XnView
Posts: 43598
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Output filename parameters

Post by xnview »

i've already added for next version '$#' to escape '#', perhaps i can add '$$' & '$%'?
Pierre.
Mixer
Banned
Posts: 166
Joined: Fri Aug 28, 2015 6:24 am

Re: Output filename parameters

Post by Mixer »

Are you going to add escape character to escape sequence "$#" if it is present in name of file too? And then add another escape character to escape this new escape character if you again choose some character allowed for using in filenames? Until all filename is filled by escape characters up to MAX_PATH? Persecution mania much?

Besides,
xnview wrote:perhaps i can add '$$'
, '$$' is already in use by
nconvert -help wrote: -o filename : Output filename
Use $$ to specify source folder name
Post Reply