Windows Batch To Copy Picture Files From Your Library (For Other Uses)
#1
Mods, you can put this one in Off-Topic or whereever it should be, I wasn't sure what forum to post in. I've mostly been too busy to come post on this forum lately, but I just threw together a script some people may find useful
I am pretty obsessive / methodical about my media, so I have a very standardized setup that I use with XBMC. I recently began goofing around with iPhoto and other similar things, and found that I would like to be able to copy my cover art and posters to a separate folder to play with, use in screensavers, etc.
I wrote a little Windows Batch script that rolls through the target folder, takes the folder name, and copies stuff out based on that folder name. This is best explained via examples.

I have all my music organized in folders per-artist. In each artist folder I have a square folder.jpg image and a 16:9 fanart.jpg image.
Batch:
Code:
FOR /D %%f in ([color=blue]D:\Music\[/color]*) do copy "%%~ff\[color=blue]fanart.jpg[/color]" "[color=blue]D:\BandPix\16x9\[/color]%%~nf.jpg"
Filenames Before & After (random example):
Before: D:\Music\Weezer\fanart.jpg
After: D:\MusicPix\16x9\Weezer.jpg

In that batch code, I have color coded the stuff you will need to replace with your own values. D:\Music\ is the path to where the per-artist folders are and D:\BandPix\16x9\ is the path where you want the output to go. This uses the copy command, so it doesn't remove or rename any existing files.

To do the album artwork, I had to use a nested batch script, where the main batch script rolls through my music folder and calls a secondary script on each artist folder. I'm sure there are other, probably better ways to do this, but it worked for me.
Main Script:
Code:
FOR /D %%f in ([color=blue]D:\Music\[/color]*) do album.bat %%f
Secondary Script:
Code:
%~d1
cd %1
for /D %%x in (*) do copy "%%~fx\folder.jpg" "[color=blue]D:\BandPix\Albums\[/color]%%~nx.jpg"
To make this work, I named the secondary script file album.bat and stuck it into C:\Windows\System32, which makes it possible to call that script at the command line simply by invoking "album.bat" without the quotes. As with the first example, you will want to change the source and output paths as needed.
I will do my movies / TV shows next, but in doing this I found that WMP has been resizing my folder.jpgs to 200x200 without asking me (Thanks Microsoft!), so I'm having to work on that problem now...
Catchy Signature Here
Reply

Logout Mark Read Team Forum Stats Members Help
Windows Batch To Copy Picture Files From Your Library (For Other Uses)0