Ok, I managed to get around the problem finding out a nice (but still not perfect) solution. It' still a work in progress and is not a one-click solution.
Nonetheless, it's perfect if you have 100s of directories containing music or video and you like to see related covers for each and every one in the good-old XP style (which I really prefer to the modern Seven style).
---------------------------------------------------------
Disclaimer:
Beware! I make use of a quick and dirty batch script in which I didn't write any kind of error checking; that means the script is not error proof.
I tried to be as much clean as possible and nothing inside the script is going to override or delete any file other the temporary ones it creates itself. Anyway, beware, I'm not going to be held responsible for any lost file, be carefull.
---------------------------------------------------------
The trick is to make use of Windows Seven's capabilities in using desktop.ini files to specify which icon to use as a directory thumbnail.
I created a little batch script that recursively does the following on each subdirectory inside the one it runs in:
- makes ImageMagick convert the folder.jpg file into a folder.ico file;
- creates a desktop.ini file;
- makes the directory read-only. Step 1
I used ImageMagick for converting the folder.jpg to folder.ico because ... well, it does it right :-) You can change the batch script and use any other image converter you like.
Step 2
Once I got a folder.ico inside the directory I had to create a desktop.ini file containing the following:
Code:
[.ShellClassInfo]
IconResource=folder.ico,0
That tells Windows Seven to use the file folder.ico as a folder thumbnail.
Step 3
Last entry is needed for Seven, because if the folder is not read-only, Seven does not use the desktop.ini file ... strange enough, that's the way it works.
I first tested the above method on a single directory, and I was pretty happy, finally I had the very same XP style back inside Seven.
Then I proceded writing a script that does that recursevely on a bunch of directories, each containg other subdirectories, some of them having a folder.jpg and some other without. The script will convert existing folder.jpg to folder.ico and set a corresponding desktop.ini but will do nothing to the directories not having any folder.jpg inside, they will remain clean as before.
In order to make my life easier I wrote down the above desktop.ini file and stored is aside for future use. The script will not generate the desktop.ini by itself, it will simply copy it inside all the subdirs recursively.
The Batch Script Code:
xcopy desktop.ini %1\ /h
for /r /d %%x in (*) do (
pushd "%%x"
convert folder.jpg -resize 256x256 %1\folder_256.png
convert %1\folder_256.png -gravity center -background none -extent 256x256 %1\folder_256x256_alpha.png
convert %1\folder_256x256_alpha.png -resize 128x128 %1\folder_128x128_alpha.png
convert %1\folder_256x256_alpha.png -resize 96x96 %1\folder_96x96_alpha.png
convert %1\folder_256x256_alpha.png -resize 64x64 %1\folder_64x64_alpha.png
convert %1\folder_256x256_alpha.png -resize 32x32 %1\folder_32x32_alpha.png
convert %1\folder_256x256_alpha.png -resize 24x24 %1\folder_24x24_alpha.png
convert %1\folder_256x256_alpha.png -resize 16x16 %1\folder_16x16_alpha.png
convert %1\folder_256x256_alpha.png %1\folder_128x128_alpha.png %1\folder_96x96_alpha.png %1\folder_64x64_alpha.png %1\folder_32x32_alpha.png %1\folder_16x16_alpha.png folder.ico
del %1\folder_256.png
del %1\folder_256x256_alpha.png
del %1\folder_128x128_alpha.png
del %1\folder_96x96_alpha.png
del %1\folder_64x64_alpha.png
del %1\folder_32x32_alpha.png
del %1\folder_24x24_alpha.png
del %1\folder_16x16_alpha.png
if exist folder.ico xcopy %1\desktop.ini . /h
popd
if exist "%%x"\folder.ico attrib +r "%%x"
)
del /as %1\desktop.ini Syntax:
The batch script should be run on the command line. Open a Prompt Window for that.
create_icons.bat temp_dir
"temp_dir" must be a temporary directory where to store desktop.ini file and the ImageMagick working files. Those files will be deleted at the end of the process. There is no error check
Example create_icons.bat c:\temp
Note that I wrote c:\temp (without the ending slash) and not c:\temp\ !!!
Usage
Simply put, let's say you have a dir called mp3s:
- create a desktop.ini file with notepad with the above content inside. Store it inside the mp3s main folder (only once, the other copies will be made by the script) and change it's attributes to ahs (Archive, Hidden, System);
- create a create_thumbnails.bat batch file with notepad, fill it with the above content) and save it in the mp3s main folder (once, there only);
- open a command prompt window, change to the mp3s main directory and run:
create_thumbnails.bat temp_dir (where temp_dir is a temporary directory, that you have to specify, where your temporary files will be stored, read the syntax paragraph).
At the end of the process, you will have a desktop.ini and a folder.ico file inside each subdir that previously had a folder.jpg inside.
folder.jpg files will not be touched, they will still be there, ready to be read by Windows XP again :-) Just in case you have a removable drive that's gonna be used on a WInXP system too.
Limits
- It does not create the XP style 4 icon folder thumbnails for folders containg other folders. Sorry, I still haven't got a solution to that :-(
- Did I already said this script does not have any kind of error handling at all?!!!
Pay attention
- There is no error checking at all inside the script.
- It creates and deletes temporary files while working. Make shure to check where it creates them and that they not overwrite usefull already existing files.
- If you run two instances of the same batch script at once, they will interfere with each other, cross deleting their temporary files and making a mess!!!