Problem when changing filename with EXIF (-o)

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

Moderators: XnTriq, helmut, xnview

Mirabeau
Posts: 3
Joined: Fri Aug 04, 2023 6:05 pm

Problem when changing filename with EXIF (-o)

Post by Mirabeau »

I have been using XnView (GUI) for a long time, and sometimes in "Batch" mode under windows, without any problem.
So far...
Today I have to make a script to rename all photos with the shooting date (EXIF)

I basically used this code in my Batch file:

Code: Select all

"C:\Program Files (x86)\XnView\nconvert" -recurse -overwrite -o $EXIF:DateTaken[%%Y-%%m-%%d_%%H%%M%%S] "F:\Photos\ *.jpg"
the renames are done correctly, BUT...

1/ the result files are found at the Partition root and not in the original folder (!).
2/ the "-recurse" option does not seem to be supported (!)

Tree of the "F:\Photos" folder:
Image

Result command:
Image

Result on Disk:
Image

I have tried several change with the "-o" options but without any success.

I don't understand what I'm missing...
The goal is a "simple" renaming all the files of a folder recursively, and, of course, keeping the renamed files in their place

thanks in advance for any help!
cday
XnThusiast
Posts: 4136
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Problem when changing filename with EXIF (-o)

Post by cday »

While you are waiting for Pierre:

The recuse option is quite new and has possibly received minimal or no testing;

The -o term has an option to specify the source folder path.

In general when trouble shooting it is best to back up and simplify as far as possible, so you might try to get the basic code working first and then try adding recursion, but you probably know that!
Mirabeau
Posts: 3
Joined: Fri Aug 04, 2023 6:05 pm

Re: Problem when changing filename with EXIF (-o)

Post by Mirabeau »

cday wrote: Fri Aug 04, 2023 8:11 pm While you are waiting for Pierre:

The recuse option is quite new and has possibly received minimal or no testing;

The -o term has an option to specify the source folder path.

In general when trouble shooting it is best to back up and simplify as far as possible, so you might try to get the basic code working first and then try adding recursion, but you probably know that!
I created a "test" folder (the F:\Photos) to do some tests

adding a path in the "-o" option will complicate things (by a lot of course) in the case of multiple subdirectories in a tree essence (sic)
the "-recuse" option does the job well when changing size in a tree species...

There are a number of graphical applications that can do what I need, but I have to do it on the command line in order to integrate it into a Batch process... hence the use of "nconvert"

at worst, if nconvert doesn't let me do it "simply", I'm thinking of developing a tool for that (in Go/Golang or other).
but I really thought nconvert allowed it.

I'll wait for Peter ;)
Thank you for your reply
Mirabeau
Posts: 3
Joined: Fri Aug 04, 2023 6:05 pm

Re: Problem when changing filename with EXIF (-o)

Post by Mirabeau »

Hop !

I went from the alternative idea to the practice...
I developed an application in console mode, in Go (Golang), the advantage is that it's cross-platform (Windows/Linux/Mac....)

I therefore also have the advantage of having "hands on" possible options according to my future needs.
I limit myself for the moment to batch processing (with still a lot of possible options).

However, I encourage to adapt "nconvert" for batch renaming (recursive or not by option), I am very surprised that it is not currently possible (unless I am mistaken).

People mostly use GUI tools, but many also ;), do automated processing (server interoperability or otherwise) to set up processing processes.
and that... that can't be done manually, everything goes through scripts.

That's just my point of view ;)
User avatar
michel038
XnThusiast
Posts: 1381
Joined: Tue Sep 27, 2016 8:18 am
Location: France

Re: Problem when changing filename with EXIF (-o)

Post by michel038 »

Did you try to use ExifTool ?

exiftool.exe -r "-TestName<${Exif:CreateDate}_%f.%e" -d "%Y-%m-%d %H %M" F:\Photos

and then
exiftool.exe -r "-FileName<${Exif:CreateDate}_%f.%e" -d "%Y-%m-%d %H %M" F:\Photos