How does a moving wall trap work?

If anyone has played Minecraft, or seen any number of movies (Saw 5, for instance) or video games, there's a trap in which either one (or both) wall(s) moves toward the other, or the ceiling lowers until reaching the floor (think Jill Sandwich), resulting in the crushing of anything unfortunate enough to be caught in the middle.
How does this work? What makes the walls move? Wouldn't friction prevent movement of the walls? Etc

I'm sure it is possible given how there are things like trash compactors and car crushers, but I'm looking more at things like a hydraulic press sort of machine in which both presses advance far enough to completely come into contact with each other regardless of what is in between them.

This is something I'm trying to write about and I need help.

It's not possible for two walls to touch - or floor and ceiling - while there's something between them. It violates the laws of the universe. What is between them is matter and the matter will remain - though it will be crushed - no matter how much you wish it wouldn't.

Mike, I don't think you understand what he's asking. He wants the walls to touch each other WITH something in between them, like the something will somehow vanish because of the pressure. That is simply not possible.

The walls or ceiling are built within a room that has the structure to which hydraulic rams or other method for pushing are fastened with guide ways. Saying they can't touch is absurd - they just have to get close enough to crush the contents or victim.
The wall can be mounted on a guided frame that is pushed by a single cylinder - think of a railroad car being pushed from behind - or the panel can be pushed by 3 cylinders to set a plane surface. Friction doesn't matter because the "walls" are not fastened to the sides, etc. Look up a diagram of an automobile engine where the piston is pushed up by the connecting rod - it is just a very small room with the floor crushing up to the ceiling.