Gnats are also attracted to decaying organic material wheres fruit flies only feed on produce.
Flies attracted to carpet.
Phorid flies are often the first pest drawn to these corpses followed by other scavenger insects such as carpet beetles mites and other flies.
Get a fly swatter.
Moths are different from flies and from your question i will assume you actually have flies on your carpet.
If you have a lot of blow flies in your house there may be a dead animal trapped in your walls.
Remove rotten or overripe fruit from the kitchen dispose of all organic foods outside.
Avoid using rat poison to kill rodents because the carcasses can attract flies.
Still others congregate near sewage and other filth.
Ensuring that you vacuum thoroughly around the edges of room and under furniture is imperative as moths will thrive in undisturbed areas.
Often they ll just fly inside your home but can also get inside on pets or clothes.
According to pest control company orkin different types of flies are attracted to different substances and materials.
Some types of flies are drawn to fecal matter and rotting meat including carcasses.
It is wise to begin looking at the first appearance of phorid flies before the corpse can begin emitting an unpleasant smell.
Moths are attracted to moisture in spills and perspiration as well as food traces.
The flies will go down into the jar drink the solution and become poisoned and trapped in the jar.
This works best for fruit flies because they are attracted to the fermented apple smell.
Others are attracted to sugary and vinegary substances.
You may need to tear open your walls to remove the corpse.
Clean up animal feces such as in a cat s litter box right away.
House and blow flies lay eggs in animal manure so dispose of pet particularly dog waste frequently.
Some species may infest seeds cereal pet.
Carpet beetles are often attracted to light and warmth indoors.
Flies are attracted to light.
These bugs lay eggs in soil where conditions are moist and there is decaying matter to feed upon.
Flies are attracted to food so i further assume that there is some food material solid or liquid resident in the pile.
The eggs of the gnats hatch in the soil and the larva live and feed on fungal material found there.
For information on carpet moth treatment please click on this link.
However blow flies are only attracted to fresh carcasses so they don t stay very long.
Clean up pet or livestock feed to keep house and stable flies away.
They work great if you have good aim.