Recursive

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

Moderators: XnTriq, xnview

Post Reply
gnasirator
Posts: 1
Joined: Thu Mar 26, 2015 5:16 pm

Recursive

Post by gnasirator » Thu Mar 26, 2015 5:28 pm

Hi there,

I was wondering, if there might come a '-r' flag to nconvert anytime in the future?
It would make batch processing big folders a lot easier.

For all linux users, who'd like to do batch processing recursively, here is my current solution.
Edit .bashrc like this or similar:

function autorot()
{
export autorot_orig=$(readlink -f $(pwd));
find . -type d -print0 | while IFS= read -r -d '' autorot_dir; do cd "$autorot_orig"; cd "$autorot_dir"; nconvert -jpegtrans exif -overwrite *.jpg; done;
cd "$autorot_orig";
unset autorot_orig;
unset autorot_dir;
}

function autolevels()
{
export autorot_orig=$(readlink -f $(pwd));
find . -type d -print0 | while IFS= read -r -d '' autorot_dir; do cd "$autorot_orig"; cd "$autorot_dir"; nconvert -autocontrast -autolevels -overwrite *.jpg; done;
cd "$autorot_orig";
unset autorot_orig;
unset autorot_dir;
unset a;
}

Then use either autorot or autolevels (as example here) in the folder, you want to process including subfolder.
This will start nconvert once per found folder and hence works as fast as possible.

Edit nconvert parameters to your needs ...

Post Reply