We went through that; my wife ended up removing everything and throwing away anything that may have had an infestation, then puttying all of the most minor indentations (nails, etc), a couple of coats of kilz and a couple of coats of paint later and they have been gone now for over a year.
These moths are feeding on grain products. Put everything in glass or some sort of sealed containers. Check products carefully as you do this. You will find one box of something that has them in it. Even if the box is factory sealed there can be a very tiny hole that you cannot see. Then once everything is sealed up and checked clean everything shelves etc with a disinfectant cleaner.
I had the same problem, it's really awful! @Woodbridge is right. Take every single thing out of the pantry and check it. There may be little worms and sometimes they're the color of the food so you have to really look. They can get into boxes that haven't been opened through the sides. Your best bet is to throw everything out that has any sort of opening, just to be safe. Then clean the whole pantry with bleach or disinfectant. Make sure that anything you replace is in a sealed container. Like Woodbridge said, use glass containers for grains and nuts. I also find Ziploc bags to work well for certain things, but you have to make sure to seal them up well each time you open them.
Yes- chuck all your flour, cereals, and pancake mix. Put out moth traps and keep them there always, they will snare them as they sneak in, before they get to your stuff. Also use good tight sealing containers, they can chew through plastic and cardboard!
The moths are from you flour/pasta products that have gotten old. You MUST check every box and I put any unweevled (sp.) items into zip lock bags with a BAY LEAF or two. Always check any pasta when shopping by shaking the box upsidedown and sneak a look at the plastic window on the box to see if they are in there. They will fall to the bottom of the package. I have BAY LEAVES in all my drawers and on all pantry shelves and they work. Just be careful where you shop.