contink Posted July 13, 2010 Posted July 13, 2010 This script is something I put together for use with Robocopy and Image Converter plus which you can purchase for 50% off (Allow 2 days for a reply but fill out support form asking for education discount link and then will send discount purchase link). JPG-Backup-Reduce-ver2.bat - This is the one you run ECHO OFF ECHO Backup Jpeg images to the backup location robocopy "F:\Files\Source" "F:\Backups\Target" /S /SEC /COPYALL /V /NP /LOG:"F:\Backups\Robocopy-log.txt" /Z /R:10 /W:30 *.jpg REM Change directory to the source cd F:\Files\Source ECHO Start condensing images to 1600x1200 & 75% quality for /R %%d in (.) do \\server\scripts\maintenance\images\ImgResize-1600x1200JpgOver.bat "%%d\*.jpg" ImgResize-1600x1200JpgOver.bat - Store me in "\\server\scripts\maintenance\images\" "C:\Program Files\ImageConverter Plus\ICPCL.exe" -convertto jpg quality:75 -save_opt convert_subfolders:yes restore_subfolders:yes log:no -source %1 -dest "{Source path}" -target_opt if_exists:auto_overwrite -oper Resize size:1600 1200 nozoom:yes keep_prop:yes units:pixels What It Does: The system uses Robocopy to do a backup of all the original JPG images to an archive folder somewhere so you always have a fallback position and then compresses the original images in-situ using a command line version of IC+ to a more manageable size of 1600x100 @ 75% Notes: For some reason the Image Convertor (IC+) utility has a small bug in that it won't traverse sub-directories if you specify the file extension so I had to hack it around to use the FOR dos command to do it manually... Slows things down a bit but it does work so can't complain. If you want to just get ANY image files (including PDF's) you can just change the wildcard in this line: for /R %%d in (.) do \\server\scripts\maintenance\images\ImgResize-1600x1200JpgOver.bat "%%d\*.jpg" to: for /R %%d in (.) do \\server\scripts\maintenance\images\ImgResize-1600x1200JpgOver.bat "%%d\*.*" I've got this script running now on a partition used for staff files and it's currently crunching the size of the disk down by around 50% which is very welcome and long overdue... Frankly the cost of the utility and the hours spent figuring the batch file out was well worth it... Compared to the alternative of trying to re-educate the staff in less than a year 1
contink Posted July 15, 2010 Author Posted July 15, 2010 Quick note to stop anyone else coming a cropper... You need the Image Converter Plus Command line edition and not the general version. Whoever wrote their sites and documentation needs to be shot as it's not obvious that there's two versions and they seem to ignore each other but basically be warned there's a non-cmd line version which won't work with my script.
MYK-IT Posted July 15, 2010 Posted July 15, 2010 I use IrfanView - Official Homepage - one of the most popular viewers worldwide that has a batch resize / modify routine and is a free alternative.
contink Posted July 15, 2010 Author Posted July 15, 2010 I use IrfanView - Official Homepage - one of the most popular viewers worldwide that has a batch resize / modify routine and is a free alternative. Yeah but is it command line and can it be run as a scheduled task? It's great if you can spare the time to sort through but this thing just goes, searches and gets on with it... Just sooo much easier for me.
contink Posted July 15, 2010 Author Posted July 15, 2010 Minor update to allow for remote manipulation of a target folder JPG-Backup-Reduce-ver3.bat - This is the one you run ECHO OFF ECHO Map B: Drive letter to the target folder net use B: "F:\Files\Source" ECHO Backup Jpeg images to the backup location robocopy "B:" "F:\Backups\Target" /S /SEC /COPYALL /V /NP /LOG:"F:\Backups\Robocopy-log.txt" /Z /R:10 /W:30 *.jpg REM Change drive/directory to the source B: ECHO Start condensing images to 1600x1200 & 75% quality for /R %%d in (.) do \\server\scripts\maintenance\images\ImgResize-1600x1200JpgOver.bat "%%d\*.jpg" REM Change to other drive and remove drive mapping c: net use b: /DELETE /YES
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now