If your Bank of America branch disappeared, you're not alone.

The nation's second-largest bank has pulled the plug on hundreds of branches and eliminated tens of thousands of jobs over the past two years. Bank of America (BAC) is not the only big bank scaling back, but it's been among the most aggressive to do so in the United States.

The retreat is part of BofA CEO Brian Moynihan's efforts to slash costs and capitalize on the shift to mobile banking. It's also the bank's way to help make up for its gigantic legal costs as it continues to fights a litany of lawsuits related to shoddy mortgages prior to the financial crisis.

In an era of extremely low interest rates, community banking is also not that sexy.

"Back in the day, it made sense to open up bank branches all over the country. You couldn't walk down a street in New York without seeing two or three branches," said Dick Bove, a banking analyst at Rafferty Capital.

Banks then were offering free checking accounts and other incentives to lure Americans into branches and deposit their money.

But that was when interest rates weren't in the basement. Today, both short and long-term rates are extremely low. That flat yield curve makes it much more difficult for banks to turn a profit on the difference between the interest they pay out on deposits and the amount earned on loans.

"Now they don't want the deposits -- and they don't want the branches. They're getting rid of them," Bove said.

Related: Interest rates may not be near zero for much longer

BofA's shrinking footprint: Two years ago there were 5,328 U.S. branches at Bank of America. That has steadily declined every quarter since then, shrinking to 4,789 as of the end of the second quarter, a 10% drop.

Fewer branches means BofA also needs fewer employees. The bank's workforce has declined by nearly 16% over the past two years to 257,158 today.

BofA-branded ATM machines are also being slowly sliced out. They've dipped by 2% over the last two years to nearly 16,000.

Related: 8 biggest job-killing companies

Consumers jump to mobile: BofA has been able to downsize its physical presence by ramping up mobile. The lender now has more than 17.6 million customers actively using its mobile platform, where users can deposit checks and send money to others. Customers deposit 200,000 checks each day by mobile and also book about 10,000 appointments to meet with branch personnel each week.

The bank continues to "experience a shift in consumer behavior patterns away from branches and towards more self-service," BofA CFO Bruce Thompson told analysts during a conference call on Wednesday.

Of course, there is a risk that BofA and other banks could alienate less-tech savvy customers, including elderly ones who are comfortable going to a bank branch.

"Taking the branch away from them does piss them off. I do think there is a loss of customers... the Baby Boomers don't like it," said Bove.

Related: Robots threaten these 8 jobs

Other banks are scaling back, too: BofA is hardly the only bank closing branches. JPMorgan Chase (JPM) said this week its branch count has declined by 2% over the past year to 5,504. Its headcount has tumbled by 6,000, helping save the bank more than $500 million during the first half of the year.

Citigroup (C) is retreating globally, announcing plans to leave more than a dozen countries. Earlier this week it agreed to sell its retail banking businesses in Panama and Costa Rica, joining other jettisoned markets like Japan and the Czech Republic.

Wells Fargo (WFC) is the lone exception. The bank told CNNMoney its branch count has "held consistent" over the last several years at nearly 6,200 in the U.S. Wells Fargo's workforce actually increased by 1,000 to 266,000 as of the end of the second quarter, while ATMs rose by 300 to 12,800.

Wall Street loves it: Bove said BofA has been more aggressive than its rivals in shutting branches domestically. Don't expect that to change.

Bank of America shares are rallying 3% on Wednesday, and are up nearly 13% over the past year.

"Moynihan is doing what he promised. Obviously, investors love it," Bove said.