But means ‘except’ when it is used after words such as all, everything/nothing, everyone/no one, everybody/nobody:
The cleaning is done now, all but the floors. They still have to be washed.
I arrived at the airport and realised that I’d brought everything but my passport!
Everyone but Anna has checked in.
Nobody but the receptionist was left in the lobby of the hotel.
We use object pronouns after but (me, you, him, us, etc.) even in subject position:
Everybody but me has paid.
No one but him would get a job like that.
In formal situations, we can use subject pronouns after but:
Everyone but she knew how the drama was going to end.
But for + reason
But for is used to introduce the reason why something didn’t happen:
But for the traffic, I would have been here an hour ago. (The traffic was very heavy – if it weren’t for the traffic, I’d have been here an hour ago.)
They would have been badly injured but for the fact that they were wearing seat belts. (They were wearing seat belts – if it weren’t for the fact that they were wearing seat belts, they would have been badly injured.)
All but meaning ‘almost completely’
I had all but finished the essay when the computer crashed and I lost it all.
His parents had all but given up hope of seeing him again.