Flow over ducted cavities can lead to strong resonances of the trapped acoustic modes due to the presence of the cavity within the duct. Aly and Ziada (2010, “Flow-Excited Resonance of Trapped Modes of Ducted Shallow Cavities,” J. Fluids Struct., 26(1), pp. 92–120; 2011, “Azimuthal Behaviour of Flow-Excited Diametral Modes of Internal Shallow Cavities,” J. Sound Vib., 330(15), pp. 3666–3683; and 2012, “Effect of Mean Flow on the Trapped Modes of Internal Cavities,” J. Fluids Struct., 33, pp. 70–84) investigated the excitation mechanism of acoustic trapped modes in axisymmetric cavities. These trapped modes in axisymmetric cavities tend to spin because they do not have preferred orientation. The present paper investigates rectangular cross-sectional cavities as this cavity geometry introduces an orientation preference to the excited acoustic mode. Three cavities are investigated, one of which is square while the other two are rectangular. In each case, numerical simulations are performed to characterize the acoustic mode shapes and the associated acoustic particle velocity fields. The test results show the existence of stationary modes, being excited either consecutively or simultaneously, and a particular spinning mode for the cavity with square cross section. The computed acoustic pressure and particle velocity fields of the excited modes suggest complex oscillation patterns of the cavity shear layer because it is excited, at the upstream corner, by periodic distributions of the particle velocity along the shear layer circumference.