By Petula Dvorak,

Wealth and power have allowed men to get away with sexual harassment and abuse for ages, that’s not new.

From Bill Cosby to Bill Clinton, from Dominique Strauss-Kahn to Donald Trump, high-profile men have been accused of preying on women in very ugly ways. And many of them duck allegations and legal consequences for years or even decades — right up until the gratifying day that their victims finally take them down.

Which brings us to the well-deserved downfall of Bill O’Reilly, the combative Fox News host who joined his heinous pal, former Fox chairman Roger Ailes, in the unemployment line this week.

These two men are accused of using their positions to sexually harass and abuse the women in their workplace over and over again.

For years, women who worked with O’Reilly — the co-author of a book on “Old School” values — said the talking head verbally abused them, called them up at home and described lurid (and ridiculous) sex acts he wanted to perform on them. He allegedly told his associate producer that he was masturbating while talking with her and offered others promotions in exchange for sex with him.

This is a guy who was recorded telling that associate producer that he wanted to fondle her with a falafel, though he actually meant a loofah. Yet somehow that wasn’t embarrassing enough to get him off the air.

Nor were the court records that had his teenage daughter describing the way he was “choking her mom” as he “dragged her down some stairs” by the neck. Nah, keep that guy on the air and let him promote his books on family values.

Let’s put aside the ethics and morality of those accusations to just look at the corporate cost of such accusations — the lawsuits filed, the hours in negotiations with lawyers, the $15 million in settlements. And still nope. Those things weren’t enough to make Fox News say adios to a guy who gets millions of viewers by spending all his time ripping into others from the comfort of a TV studio.

No, the Fox overlords didn’t consider ditching O’Reilly until the New York Times published a stunning story earlier this month about sexual harassment settlements with five women who worked at Fox over a 15-year period. That’s when advertisers began to flee and when the cable news channel finally began to take the allegations against their top-rated host seriously.

It was all about the Benjamins, baby. Not the behavior women said he was guilty of.

But it is a reminder of the awesome power of consumers with the companies who want to sell us stuff. The allegations against O’Reilly prompted a stampede of nearly two dozen big advertisers to run away from Fox.

Hooray BMW and Mercedes-Benz. Smart move Constant Contact. And yes, it was extra sharp for the men’s shirt company called Untuckit to high-tail it away from a man who allegedly called women at night and described himself untucking something.

I know, it’s all pretty disgusting.

But there is a funny part to this.

After Fox announced they were ousting him on Thursday, O’Reilly — who famously calls anyone opposing his conservative ideas “snowflakes” — continued to whine about his fate and deny the avalanche of allegations against him.

“It is tremendously disheartening that we part ways due to completely unfounded claims,” he said in a statement after Fox announced his axing. “But that is the unfortunate reality many of us in the public eye must live with today.”

He said his accusers — all of them successful, professional women — targeted him because he’s famous. That’s a familiar defense from men like him, who are accustomed to saying and doing anything they want to the women around them.

Our president once bragged on an “Access Hollywood” tape about kissing and groping women whenever he was attracted to them.

“And when you’re a star, they let you do it,” Trump explained to Billy Bush in 2005. “You can do anything.”

“Whatever you want,” Bush agreed.

“Grab them by the p—y,” Trump said. “You can do anything.”

Most men, of course, would never talk this way. They treat their female colleagues with respect. But it is how some men in positions of power think. And in the 21st century American workplace, those men must be rooted out and fired.

The women who alleged they were being harassed by Bill O’Reilly should have been taken seriously right away. They should not have had to wait until advertisers spoke up.

But the money folks are listening. Remember that. It’s a start, and that power is in our hands.

Twitter: @petulad

Read more Petula Dvorak:

‘This isn’t about politics’: At Trump’s first Easter Egg Roll, a spirit of civility

On Easter, Mary Magdalene will be maligned as a prostitute. Except she wasn’t.

Did caring for a profoundly sick daughter cost a mother her job at Walmart?

A panty liner triggers a TSA pat-down just one step removed from a pap smear