Another method is to take an empty glass or plastic jar, poke a bunch of holes in the lid (using a nail), and put a bit of wine or vinegar in it. The files are attracted by the sent, and enter through the holes, but they are too stupid to be able to figure out how to get back out! Eventually they drop from exhaustion. [Don't tell you local SPCA that you are torturing flies]. Then the dead flies attract other flies (since they are cannibals), and you never have to change the bait --- although occasionally you have to empty some of the contents. This works for wasps too!
Starr's method is a bit simpler and easier, but "mine" is a set it up once and leave it solution.