Do you know how to move a junction box? When an electrical cable is not long enough to reach from one switch/receptacle to another, a junction box is placed somewhere in between, so that two shorter cables can be connected together in the box.
The cables enter the box through knockout covers, and each of the cable's wires connect together with wire nuts. If the junction box has to be moved, the cables are first disconnected from each other and then rejoined in the junction box's new location.
Firstly
Turn off the power to the circuit to which the junction box attaches by flipping the corresponding circuit breaker in the home's breaker box. Turn on a light switch, or plug a portable electrical appliance into a receptacle, to make sure the correct breaker has been turned off.
Second
Unscrew and remove the breaker box's cover, and pull out the wires from inside. Unscrew all wire nuts from the ends of the wires. Loosen the screws on the cable clamps attached to the box's knockout covers, and pull the cables out of the box. Remove the screws holding the box to the wall.
Third
Position the box in its new location, attaching it in place with the screws -- if screwing directly into drywall. Mark the box's screw holes on the wall. Punch through each mark on the drywall with a small screwdriver. Insert wall plugs into the holes and screw the box to the wall plugs. Remove any cable tacks holding the cable to wall studs by prying them out with pliers.
Fourth
Position the cables so that they run to the box's new location, and insert cable tacks every 18 inches to hold them in place. Push the cables through the center of the cable clamps, and into the box. Tighten the cable clamp's screws to hold the electrical cables in position.
Fiveth
Cut off the bare ends of all electrical wires if the ends are damaged, using wire cutters. Cut back 1/2-inch of plastic coating from all wire ends using wire strippers -- the ground wires will be bare. Hold together all wires of the same color, and screw on a wire nut. Make sure the nut covers all bare copper on the end of the wires. Wrap electrical insulation tape around the nut and area where the wires enter into the nut. Repeat these steps with all colored wires, including the bare ground wires.
Sixth
Push the wires and nuts into the box. Space out the wire nuts so that they don't touch each other. Place the box's cover in place and screw it in position. Turn on the power at the breaker.