There is actually a DOS command that does this (at least there used to be). Can't remember the name of it though.