Fruit flies are attracted to rotting fruit and sugary things like recycle cans from pop or juice boxes. You must eliminate the places that they are hatching from. Some also seem to live in house plants sometimes. They have a very short life span, and so attempting to kill them is a futile effort. You must clean up anything, fruit bowls, garbage, compost buckets, anything where they might be breeding.
Fruit flies are not like ordinary house flies. I don't think you have to worry about germs being spread, it is the nuisance factor with the little devils.
They are attracted to the smell of ripening fruit. Be sure to keep fruit and the garbage well covered (as in air tight). They have a short lifespan so should be gone before too long. They seem to be worse in some years. Good luck.
Find the deepest tallest jar or food container you can find, like a leftover peanut butter jar. Fill it about 1/4 with sweet juice, like cranberry or put a few fruit pieces in it. Set it out on the counter. After an hour or so the fruit flies will find it. They will love it. Quickly cover it with a piece of cardboard, or something sturdy like a writing pad to catch all the fruit flies.
A few will escape but you'll catch the majority of them. Dump it outside away from the house. Do it every hour or so, and they'll be gone in a day. Keep your fruit in the fridge. And your compost completely enclosed. I cover my compost with water too, so no fruit flies survive in it.
Add your voice to the conversation. Click here to answer this question.