Added OS detection

Added operating system detection to recurse directories properly.