1. Eliminate the sources of the fly infestation
All fly infestations can be traced back to a source of unprotected organic material. The usual culprits are improperly handled garbage, animal droppings and dead animals. There are tons of different species, all of whom enjoy feasting on different things, but their preferred main courses are not so diverse that we need to immediately differentiate them unless you are unable to remove all of the possible food sources as outlined in this article.
Fly-food and breeding grounds
The key to reducing any fly population is to identify and eradicate the feeding and breeding grounds and as luck has it, flies lay their eggs in their food. Follow along as I walk you through some of the most common attractants and explain what you can do about them. Garbage and decaying organic matter Many filth fly infestations are the result of improperly handled human wastes. Perform a thorough inspection of every nearby area that collects organic waste such as garbage cans, dumpsters, and compost heaps (Learn how to make compost). Flies will feed and breed in any of these places assuming the waste is moist and accessible. Make sure all garbage is bagged and stored in garbage cans with tightly-fitting lids secured to the cans. In the case of metal trash cans, a pair of bungee cords can be threaded through the handles and over the lid to keep it secure. Dumpster's should have hinged lids that are kept closed and compost heaps should be screened off or contained in tubs. Look around for loose organic materials and spills. Inside of your home, organic waste should be drained and wrapped in newspaper prior to throwing into the trash. The paper will help to dry out the waste - flies can't breed in dry waste. Make sure your trash can has a tightly fitting lid, and tie the bag completely shut before transferring to an outside can for trash pickup. If you have flies breeding in your drains (Tips on how to get rid of drain flies), a commercial drain cleaner will remove the organic film that they are breeding in. Animal waste There's nothing flies seem to like more than a warm log straight from your dog... Any animal waste should be picked up and immediately buried or flushed down the toilet. Decaying flesh Dead and decaying animal flesh can also breed flies - not to mention the horrible smell and appearance. Search around for dead birds, rodents, squirrels, and road kill. If you locate an unfortunate critter, use a shovel to move it and bury it at least three feet deep to keep any flies that spawn from it from reaching the surface.
Other attractants
Some varieties of flies feed on the blood of living creatures. These are a little harder to battle since you can't completely eliminate their food source (you). Others lay eggs in other insects and earth worms. These types of flies are better battled with traps and physical barriers like screens and netting.