Generic file replacement