Measure the door opening from the finished floor vertically to the top of the opening. Note that the opening should be 1 1/2 inches taller than the bi-fold doors.
Trim up to 3/16-inch from the tops and bottoms of each panel of the bi-fold doors with a circular saw to bring the height of the doors to 1 1/2 inch less than the vertical measurement of the door opening. Scribe a line across the door with a pencil and a straight edge to use as a guide for cutting, if desired.
Choose a thickness of trim lumber that is equal to the distance needed to bring the vertical height measurement of the opening to 1 1/2 inches higher than the door if the opening is too high. Cut the trim to the exact width of the door opening. Center the piece to the trim that is already present at the top of the opening and nail it in place with 8D finish nails.
Measure the width of the door opening with a measuring tape. Note that this measurement Must be 1/2-inch wider than the width of the bi-fold doors. The vertical edges of each panel of the door can be trimmed up to 3/16-inch to reduce the width of the doors to fit the opening, or trim pieces can be added to the vertical sides of the opening to decrease the opening width in the same fashion as previously.