There is a rule stated on englishgrammar.org saying that we use bare infintives
After some prepositions like except, but, save and than
She can do everything but cook.
She did nothing except cry.
However, we can see usage of both Gerund and to + verb 1 after them.
“She wasn't doing a thing that I could see, except standing there leaning on the balcony railing, holding the universe together.” ― J.D. Salinger (goodreads)
"But Maclean had taken his share of the punch, and vowed that no gentleman should leave his table after the bowl was brewed; so there was nothing for it but to sit and hear Jacobite toasts and Gaelic songs, till all were tipsy and staggered off to the bed or the barn for their night's rest."
So, what's the rule for non-finite verbs' usage after these words?