MEDFORD, N.J. (CBSNewYork/AP) — A New Jersey man who spent decades preparing his home for doomsday is donating all of his stored food to families affected by Hurricane Maria in Puerto Rico.

Joe Badame and his late wife built a bunker in their basement filled with barrels of non-perishable food.

Sadly, the 74-year-old Medford man is losing his house to foreclosure, but he decided to turn his bad luck into something good by donating all the food to families in Puerto Rico affected by Hurricane Maria.

“There is nonfat dry milk, there’s powdered eggs. Most of the stuff I bought is for long-term storage,” he said.

Badame had gathered 80 barrels of food that each could sustain 84 people for four months. He said the food, which included dried beans, rice, flour, sugar, pancake mixes and more, would have been thrown away otherwise.

Badame started preparing for the worst with his wife Phyliss in the 1970s. He estimated they spent close to a million dollars on the project.

Their prepping was put on hold after Phyliss suffered a massive stroke in 2005 that left her paralyzed.

Badame quit his job, took out a half-million loan on his house and spent his time caring for his wife. By the time his wife died in 2013, he was broke.

It was at an estate sale last month where Badame met a couple raising money for their family affected by Hurricane Maria in Puerto Rico.

Badame made a $100 donation, and then led the couple to the room where he stored all of his food and told them to take it all.

Badame said meeting the two gave him a new purpose in life.

(© Copyright 2017 CBS Broadcasting Inc. All Rights Reserved. The Associated Press contributed to this report.)