---
search:
  tags:
    - Torrents
    - POST
seo:
  description: >-
    Renames the file or folder on disk too. Paths are relative to the save…
    Reference for the POST /torrents/{hash}/files/rename endpoint in the
    piecemeal API.
sidebar:
  label: Rename a file or folder
  badge: POST
title: Rename a file or folder
type: openapi-operation
---
Renames the file or folder on disk too. Paths are relative to the save path with / separators.

`POST /torrents/{hash}/files/rename`

**Request body** (`application/json`, required)

- `newPath` (string, required)
- `oldPath` (string, required) — A file's or folder's path as listTorrentFiles reports it.

Request body example:

```json
{
  "newPath": "string",
  "oldPath": "string"
}
```

**Responses**

- `204` — No Content
- `401` — Unauthorized
- `403` — Forbidden
- `422` — Unprocessable Entity
- `500` — Internal Server Error
