Thousands spent the night on beaches and streets during what Greece said was its biggest safe transport of residents and tourists in emergency conditions.