yeah, Aken, but he probably doesn't want to click on/off all those options and confirm "OK" every time he wants to purge empty layers...
here's what you want Raptor (only tested on Maya 3.01!):
string $allLayers[]=ls -type displayLayer
;
for ($node in $allLayers)
{
string $members[]=editDisplayLayerMembers -query $node
;
if (size($members)==0)
{
if (strcmp $node "defaultLayer"
!=0)
{
delete $node;
}
}
}