dwarves had not passed that way for many years , but gandalf had , and he knew how evil and danger had grown and thriven in the wild , since the dragons had driven men from the lands , and the goblins had spread in secret after the battle of the mines of moria .