Wash all of your cabinets inside and out. This will remove a lot of the eggs. Store all pasta, flour and the like in sealed containers that don’t let air inside. Freeze all of these things when you purchase them to kill any of the moths that may be inside. It takes at least 2 weeks to kill off all the eggs that hatch. You must wash the shelves every day. Use a light bleach solution then rinse throughly and make sure they don’t have water or food sources. I had them once all summer I killed them regularly but they got into some dog food and lived off of that. I finally got rid of all food sources and and then used long lasting bug spray to get rid of them. I didn’t know about these other methods at the time.