I found this as I was just searching for the same answer as you. Don't know if it really works but at least there aren't any chemicals involved:
Take a clear ziplock bag and put some water in it (1/2 to 3/4 or about that). The sun shines on the water and reflects a "spider web" effect. The flies will not enter for fear of getting caught in the web.
I've also heard this is the reason:
Evidently, houseflies, being highly edible and defenseless, are nervous types, and don't like to sit still when they see something moving nearby, because it could be a predator. The water bag acts a bit like a lens--try it some time--in which the movements of people in the area are reflected. Even if the fly is too far from the action to see it directly, it can see a shifting of light and dark in the water bag, which it interprets as nearby movement, and it will fly away from the bag.
Also, I witnessed at my MIL's house that house & fruit flies don't like basil. So her granddaughter recently bought her a basil plant that she keeps in her kitchen. Presto....no more flies!
I think I'll try these ideas myself since in the past week our house has been swarmed by flies. I know our hens must be dealing with the same problem. Good luck and let me know if this helps you out!