We had some in the house once from banana going bad and I used some trick I found on the internet. It was a bowl of water - maybe sugar water with a drop of dish soap in it. The flies land on the water and get stuck because of the soap. It worked but I only had a few.

Here's what I just found on the internet. Probably won't work too well for a major infestation though.

Mix the following ingredients together in an open jar or other container (the quantities are relative to how many flies you're trying to get rid of):

1/2 qt water (2 c)
2 T sugar
2 T (white) vinegar
a couple drops of liquid dishsoap
Leave the mixture sitting out in the infested area, as long as needed.