In this letter, we propose a new algorithm to determine the position of the sidewalls by exploiting the multipath echoes of a target bounced from the sidewalls, which is useful to obtain the building layout, determine the relative position of the target in the room, and remove the higher order multipath ghosts for a through-wall tracking radar. Specifically, we first extract the 1-D trajectories of the real target and the multipath ghosts in each receive channel, based on the local maximum values extraction method and the 1-D Kalman filter. Second, by exploiting the principle of the first-order multipath echoes, the position of the sidewall is computed in each frame. In addition, the sidewall position can be obtained by averaging the coordinates of the target and the ghost in the presence of the second-order multipath echoes. Finally, the average of multiple frames is adopted to improve the detection accuracy. The proposed algorithm is validated by simulation and experimental data.