To prevent flies, you should have your trash covered at all times. It is important to take out the trash as quickly as possible as well.