nconvert option -D deletes input files if used a second time

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

Moderators: XnTriq, xnview

Post Reply
EuM_Expert
Posts: 19
Joined: Mon Jul 23, 2012 1:54 pm

nconvert option -D deletes input files if used a second time

Post by EuM_Expert »

I am still trying to automate some regular procedure I do with my images.
I wrote a batch file with several invocations of nconvert (version 6.21, Win7 x64) to perform the individual steps, e.g. rotate, re-size, normalize, rename, add text.
It might make sense to use the batch a second time, after the first run was performed.

Then the batch does not work anymore, and nconvert deletes all images.
The malicious option is the -D option of nconvert.
The first run works perfectly, since the files are renamed, i.e. nconvert processes the input files into a new named file and deletes the input files afterwards.
The second run finds that input and output file name are exactly the same and the -D option irrevocably deletes all images.

Here's the line of the batch file:

Code: Select all

"C:\Program Files\nConvert\nconvert.exe" -v -normalize -autocontrast -autolevels -ratio -rtype lanczos -rflag decr -rflag orient -resize 1280 1024 -D -overwrite -out jpeg -o $\$$_###.jpg %1\*.jpg
For the first run, the folder might be "zzzz", the images might be image1.jpg, image2.jpg, etc.
After the first run, (and as input for the second run) the images are named zzzz_001.jpg, zzzz_002.jpg, etc.

I think the behavior of the -D option is quite strange, instead of deleting in the case that the input and output file is the same, it should NOT delete anything after the conversion. The current behavior is quite ZEN-like, create it and the final step of the creation is to destroy everything :o. Automation is not easily possible, because one must carefully check if the folder-name and file-names differ (i.e. situation for first run) and use different scripts, one with the -D option, the other without it!

Is it possible to fix that?
Or am I doing something wrong?
Or can another option be used to modify the -D behavior if input and output file are of the same name?
User avatar
xnview
Author of XnView
Posts: 34089
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: nconvert option -D deletes input files if used a second

Post by xnview »

strange, could you send me your email by email or PM
Pierre.
Post Reply