# RPOPLPUSH

> Pop the last element of one list and push it to the head of another (older form of LMOVE).

URL: https://docs.hotkv.com/commands/rpoplpush/

```
RPOPLPUSH source destination
```

- Group: List
- Complexity: O(1)
- HotKV Cloud: all plans
- On-Premise: no license needed
- Deprecated: use LMOVE instead

`RPOPLPUSH` removes the last element of the list at `source` and pushes it to
the head of the list at `destination`, atomically. It is the same as
`LMOVE source destination RIGHT LEFT`; new code should use
[LMOVE](https://docs.hotkv.com/commands/lmove/index.md).

`destination` is created if needed, and `source` is deleted when its last
element leaves. Using the same key for both rotates the list, moving the last
element to the front.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| Moved | Bulk string: the element that was moved | Same |
| `source` does not exist | Nil bulk string | Null |

`RPOPLPUSH` replies with a `WRONGTYPE` error if `source` is not a list, or if
`destination` exists and is not a list. Nothing is moved in that case.

## Examples

```
127.0.0.1:6379> RPUSH src a b c
(integer) 3
127.0.0.1:6379> RPOPLPUSH src dst
"c"
127.0.0.1:6379> LRANGE dst 0 -1
1) "c"
```

## Compatibility

Same as Redis 7.4 and Valkey 8, where it is also deprecated in favour of
`LMOVE`.

## See also

[LMOVE](https://docs.hotkv.com/commands/lmove/index.md), [BRPOPLPUSH](https://docs.hotkv.com/commands/brpoplpush/index.md), [BLMOVE](https://docs.hotkv.com/commands/blmove/index.md)