Windows Folder Magic is a small command-line tool that automatically sets folder icons based on whether the folder (and its subfolders) are empty or not. A folder is defined as "empty" if it contains files and not only folders. This is helpful if you have repeating standard folder structures where only a few contain content. The tool is written in Java, and the download also includes a console wrapper executable. You can specify separate icons for non-empty and empty folders.
This is the command line for all operating systems:
java -jar WindowsFolderMagic
-setDefaultIconFile:C:\example\icons\default-folder.ico -setDefaultIconIndex:0
-setEmptyIconFile:%SystemRoot%\system32\SHELL32.dll -setEmptyIconIndex:215
-updateFolderIcon:C:\example\folder
This is the command line for Windows:
And these are the resulting folder icons for the example above. Non-empty folders now have a disk icon: