Bifold doors allow you to have doors on your closet without having to have the clearance for swing-out doors. Purchase a bifold door kit that includes a set of doors, headrail track, anchor brackets, guideposts and pivot posts. Most kits have doors with predrilled holes for ease of use. Use the bifold door's manufacturer's instructions as a guide to fit your particular doors.
Measure your closest opening. Measure the inside top of your closest opening for the headrail track. Cut the headrail track with a hacksaw so it will fit snugly at the top of the opening.
Insert the roller mounts into the headrail track. For many bifold doors, you slide the roller mounts into the headrail track from the end of the track, but this varies based on the manufacturer. Secure the headrail track to the inside of the top of the opening by screwing panhead screws into the track's screw holes.
Line up the anchor brackets at the bottoms of both sides of the opening. Set the long end of the bracket on the floor with the short end against the wall. Mark the locations of the anchor brackets so they are parallel to the headrail track. Screw flathead screws into the two screw holes in the short end of the anchors.
Measure the height of the doors. Cut the height of the doors with a saw if they are too tall to fit into the opening. Locate the guide post hole that will be closest to the walls at the top and bottom of the doors. Slide one guide post securely into the predrilled guide post hole. Fit pivot posts securely into the rest of the holes at the tops of the doors.
Lift the door to snap the pivot posts into the headrail track. Push the guide posts into to the headrail track and into the anchor bracket. Continue to fit the other door into the track and bracket. Adjust the doors by following the manufacturer's instructions.