Do you have an invasion of blow flies (metallic blue-green flies)?
Do you have an invasion of shore flies (small black flies with red eyes and short antennae)?
Do you have an invasion of whiteflies (small white moth-like flies)?
To get rid of blow flies first you need to destroy the breeding source, which is usually some decaying animal. Once you find the spot, you need to clean it thoroughly with a borax-and-water solution. Second, you need to get rid of all of the adult flies, and you can do this by hanging a yellow sticky fly catcher card or using a chemical spray. Prevent their return by making sure no type of decay is ever inside or near the outside of your greenhouse. Keep your greenhouse clean at all times, and you shouldn’t have any problems with these flies from then on.
Shore flies tend to only cause aesthetic damage to a plant, so that isn’t something to be concerned about unless you are growing ornamental plants intended to be brought indoors. Get rid of any water or damp areas under benches because those areas can attract shore flies. A shore fly loves damp places that might allow them to find more fungi to eat. Shore flies are attracted to blue sticky traps. Use 10 traps per 1,000 sq. feet. There are several pesticides available for the control of shore flies. Consult with your local extension agency for information on chemical controls.
Once you notice whiteflies on or near your plants, take your hose and wash them off of the plants. The blast of water should be enough to remove most of them. Encarsia formosa is a tiny parasitic wasp that kills whiteflies. The eggs of these wasps can be purchased online. The most effective time of introducing Encarsia formosa is just as the first whiteflies are appearing. You can also purchase an organic insecticidal soap, mix some in a spray bottle with water, and spray the plants thoroughly, especially the undersides of the leaves. Repeated applications may be necessary.
Both fungus gnats and fungus gnat larvae can be found in greenhouses. Fungus gnats like doing most of their damage underneath the soil, which can make it a challenge to control them properly. Do not over-water the plants. Try not to water them until the top two inches of the soil are dry. Use butterfly-shaped sticky stakes, which go underneath the plants and can get rid of some of the fungus gnat larvae. Fungus gnat adults can be trapped with yellow sticky traps placed horizontally at the crop canopy. You can also use a lot of mulch like wood chips in your plants because this will keep the fungus gnat adults away.
https://finestgreenhouse.com/growers-guides/why-is-my-greenhouse-full-of-flies/#Blow_flies
https://www.gardeningknowhow.com/plant-problems/pests/insects/fungus-gnat-vs-shore-fly.htm

Sreten null
Hi! I’m Sreten Filipović. I graduated from the Faculty of Agriculture at the University of Belgrade, with a master's degree in Environmental Protection in Agricultural Systems. I’ve worked as a researcher at Finland's Natural Resources Institute (LUKE) on a project aimed at adapting south-western Finland to drought episodes. I founded a consulting agency in the field of environment and agriculture to help farmers who want to implement the principles of sustainability on their farms. I’m also a founding member of the nonprofit organization Ecogenesis from Belgrade whose main goal is non-formal education on the environment and ecology. In my spare time, I like to write blog posts about sustainability, the environment, animal farming, horticulture, and plant protection. I’ve also published several science-fiction short stories.
You can find me on LinkedIn at https://www.linkedin.com/in/sreten-filipovi%C4%87-515aa5158/