Insert the edge of a flat pry bar behind the end of the piece of shoe molding.
Tap the top of the pry bar with a hammer to wedge the bar behind the molding and loosen it from the wall.
Push gently upward on the handle of the pry bar to loosen the molding from the wall. Slide the pry bar along the piece of shoe molding to loosen it completely along the length of the wall.
Pull the molding away from the wall and set it aside.
Insert the edge of a flat pry bar under the corner of the carpet.
Push up on the handle of the pry bar to loosen the carpet from the tack strip underneath.
Grip the edge of the corner of the loosened carpet with the pincers on a pair of needle-nose pliers. Pull the corner of the carpet back.