Influence of confinement on thermodiffusion