I'm looking to replace and old ceiling fan that was in our house with a standard light. The ceiling fan wad taken out by the previous owner and wires were all capped off and a cover put on a junction box. The junction box has 2 blacks, 2 whites, and 2 grounds that were piggied together with a short lead connected to it. The switch only controlled the light according to the previous owner. The one set of wires has constant power which I'm guessing powered the fan which you started with the pull chain. The other set of wires has no power. How in the heck do I wire this thing up so that I can control the new night with the previous light switch??
What you've got is common switch loop. After turning off the power, take the black wire from the constant power and connect it to the white wire from the other set and mark that white wire with some black tape to show it's always hot. Take the black wire from that set and the white wire from the constant power set and hook them up to your light fixture. Take the pigtailed ground wire and connect it to the light fixture.