Page 1 of 1
Batch Script to Resize *.jpg in Folder and Subfolders
Posted: Fri Oct 23, 2015 10:10 am
by Erik_IG
Hi all,
I am looking for an automated process to periodically let NConvert resize all my .jpg files on a server based on folders and subfolders.
Currently I got a script working but that one only allows resizing the files in the specific folder, I need it to include all subfolders as well.
Code: Select all
nconvert -overwrite -ratio -rtype lanczos -rflag decr -resize 1920 1200 *.*
Any idea what I need to include into this script to get it working on subfolders as well ?
Many thanks,
Erik
Re: Batch Script to Resize *.jpg in Folder and Subfolders
Posted: Fri Oct 23, 2015 2:41 pm
by cday
Erik_IG wrote:I am looking for an automated process to periodically let NConvert resize all my .jpg files on a server based on folders and subfolders.
Currently I got a script working but that one only allows resizing the files in the specific folder, I need it to include all subfolders as well.
Code: Select all
nconvert -overwrite -ratio -rtype lanczos -rflag decr -resize 1920 1200 *.*
Any idea what I need to include into this script to get it working on subfolders as well?
While the GUI XnView software (XnView Classic, XnViewMP and XnConvert) batch convert functions all have an option to keep the folder structure, there is no mention of a recursive option in the NConvert Help file, and the following posts seem to suggest that recursion isn't supported:
Recursive
recursive
I'm no command line expert, but when the folder structure is fixed, could the desired result possibly be achieved by using wildcards in the file paths??
If you do try that please proceed with great caution, and it would be interesting to know the result...

Re: Batch Script to Resize *.jpg in Folder and Subfolders
Posted: Fri Oct 23, 2015 3:34 pm
by oops66
Erik_IG wrote:Any idea what I need to include into this script to get it working on subfolders as well ?
Hello,
Maybe you can try something like that, with a find cmd (here for linux) ( in a terminal, find "." from the root directory of the jpg)
Code: Select all
cd yourrootdirectoryofyourjpg
find . -iname "*.jpg" -exec nconvert -overwrite -ratio -rtype lanczos -rflag decr -resize 1920 1200 {} \;