There is no quick fix to permanently deodorizing your closet, but with a little trial and error you should be able to deal with the source of the problem and get your clothing smelling fresh again.
What you will need:
Baking soda (for absorbing moisture and bad odors in fabrics)
White Vinegar (for neutralizing bad odors on hard surfaces)
Step 1: Remove all contents from the closet, including items on the floor, hangers, and shelves.
Step 2: Sprinkle baking soda on the closet’s carpet and vacuum after an hour. This should help absorb excess moisture and remove unpleasant odors that could be lingering in the carpet fabrics.1
Step 3: Fill a spray bottle with a mixture of half water, half white vinegar. Test it on a hidden spot first to see if the mixture causes any adverse reaction on surfaces. Next gently spray all the surfaces in the closet, including the walls, shelves and ceiling. If you have hard flooring also spray with the mixture. Don’t worry about the smell of vinegar, this will disappear soon after evaporating.4
Step 4: Give the room with your closet a thorough cleaning, paying special attention to dust and any damp patches.
Step 5: Placing a bowl of baking soda in the closet will help absorb lingering smells in the air. Make sure you remove the bowl after 24 hours.1