mirror of
https://github.com/rclone/rclone.git
synced 2026-01-01 08:03:26 +00:00
Version v1.72.0
This commit is contained in:
@@ -10,8 +10,8 @@ Convert file and directory names in place.
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
convmv supports advanced path name transformations for converting and renaming files and directories by applying prefixes, suffixes, and other alterations.
|
||||
convmv supports advanced path name transformations for converting and renaming
|
||||
files and directories by applying prefixes, suffixes, and other alterations.
|
||||
|
||||
| Command | Description |
|
||||
|------|------|
|
||||
@@ -20,10 +20,13 @@ convmv supports advanced path name transformations for converting and renaming f
|
||||
| `--name-transform suffix_keep_extension=XXXX` | Appends XXXX to the file name while preserving the original file extension. |
|
||||
| `--name-transform trimprefix=XXXX` | Removes XXXX if it appears at the start of the file name. |
|
||||
| `--name-transform trimsuffix=XXXX` | Removes XXXX if it appears at the end of the file name. |
|
||||
| `--name-transform regex=/pattern/replacement/` | Applies a regex-based transformation. |
|
||||
| `--name-transform regex=pattern/replacement` | Applies a regex-based transformation. |
|
||||
| `--name-transform replace=old:new` | Replaces occurrences of old with new in the file name. |
|
||||
| `--name-transform date={YYYYMMDD}` | Appends or prefixes the specified date format. |
|
||||
| `--name-transform truncate=N` | Truncates the file name to a maximum of N characters. |
|
||||
| `--name-transform truncate_keep_extension=N` | Truncates the file name to a maximum of N characters while preserving the original file extension. |
|
||||
| `--name-transform truncate_bytes=N` | Truncates the file name to a maximum of N bytes (not characters). |
|
||||
| `--name-transform truncate_bytes_keep_extension=N` | Truncates the file name to a maximum of N bytes (not characters) while preserving the original file extension. |
|
||||
| `--name-transform base64encode` | Encodes the file name in Base64. |
|
||||
| `--name-transform base64decode` | Decodes a Base64-encoded file name. |
|
||||
| `--name-transform encoder=ENCODING` | Converts the file name to the specified encoding (e.g., ISO-8859-1, Windows-1252, Macintosh). |
|
||||
@@ -38,211 +41,227 @@ convmv supports advanced path name transformations for converting and renaming f
|
||||
| `--name-transform nfd` | Converts the file name to NFD Unicode normalization form. |
|
||||
| `--name-transform nfkc` | Converts the file name to NFKC Unicode normalization form. |
|
||||
| `--name-transform nfkd` | Converts the file name to NFKD Unicode normalization form. |
|
||||
| `--name-transform command=/path/to/my/programfile names.` | Executes an external program to transform |
|
||||
| `--name-transform command=/path/to/my/programfile names.` | Executes an external program to transform. |
|
||||
|
||||
Conversion modes:
|
||||
|
||||
Conversion modes:
|
||||
```text
|
||||
none
|
||||
nfc
|
||||
nfd
|
||||
nfkc
|
||||
nfkd
|
||||
replace
|
||||
prefix
|
||||
suffix
|
||||
suffix_keep_extension
|
||||
trimprefix
|
||||
trimsuffix
|
||||
index
|
||||
date
|
||||
truncate
|
||||
truncate_keep_extension
|
||||
truncate_bytes
|
||||
truncate_bytes_keep_extension
|
||||
base64encode
|
||||
base64decode
|
||||
encoder
|
||||
decoder
|
||||
ISO-8859-1
|
||||
Windows-1252
|
||||
Macintosh
|
||||
charmap
|
||||
lowercase
|
||||
uppercase
|
||||
titlecase
|
||||
ascii
|
||||
url
|
||||
regex
|
||||
command
|
||||
```
|
||||
none
|
||||
nfc
|
||||
nfd
|
||||
nfkc
|
||||
nfkd
|
||||
replace
|
||||
prefix
|
||||
suffix
|
||||
suffix_keep_extension
|
||||
trimprefix
|
||||
trimsuffix
|
||||
index
|
||||
date
|
||||
truncate
|
||||
base64encode
|
||||
base64decode
|
||||
encoder
|
||||
decoder
|
||||
ISO-8859-1
|
||||
Windows-1252
|
||||
Macintosh
|
||||
charmap
|
||||
lowercase
|
||||
uppercase
|
||||
titlecase
|
||||
ascii
|
||||
url
|
||||
regex
|
||||
command
|
||||
```
|
||||
Char maps:
|
||||
```
|
||||
|
||||
IBM-Code-Page-037
|
||||
IBM-Code-Page-437
|
||||
IBM-Code-Page-850
|
||||
IBM-Code-Page-852
|
||||
IBM-Code-Page-855
|
||||
Windows-Code-Page-858
|
||||
IBM-Code-Page-860
|
||||
IBM-Code-Page-862
|
||||
IBM-Code-Page-863
|
||||
IBM-Code-Page-865
|
||||
IBM-Code-Page-866
|
||||
IBM-Code-Page-1047
|
||||
IBM-Code-Page-1140
|
||||
ISO-8859-1
|
||||
ISO-8859-2
|
||||
ISO-8859-3
|
||||
ISO-8859-4
|
||||
ISO-8859-5
|
||||
ISO-8859-6
|
||||
ISO-8859-7
|
||||
ISO-8859-8
|
||||
ISO-8859-9
|
||||
ISO-8859-10
|
||||
ISO-8859-13
|
||||
ISO-8859-14
|
||||
ISO-8859-15
|
||||
ISO-8859-16
|
||||
KOI8-R
|
||||
KOI8-U
|
||||
Macintosh
|
||||
Macintosh-Cyrillic
|
||||
Windows-874
|
||||
Windows-1250
|
||||
Windows-1251
|
||||
Windows-1252
|
||||
Windows-1253
|
||||
Windows-1254
|
||||
Windows-1255
|
||||
Windows-1256
|
||||
Windows-1257
|
||||
Windows-1258
|
||||
X-User-Defined
|
||||
```
|
||||
Encoding masks:
|
||||
```
|
||||
Asterisk
|
||||
BackQuote
|
||||
BackSlash
|
||||
Colon
|
||||
CrLf
|
||||
Ctl
|
||||
Del
|
||||
Dollar
|
||||
Dot
|
||||
DoubleQuote
|
||||
Exclamation
|
||||
Hash
|
||||
InvalidUtf8
|
||||
LeftCrLfHtVt
|
||||
LeftPeriod
|
||||
LeftSpace
|
||||
LeftTilde
|
||||
LtGt
|
||||
None
|
||||
Percent
|
||||
Pipe
|
||||
Question
|
||||
Raw
|
||||
RightCrLfHtVt
|
||||
RightPeriod
|
||||
RightSpace
|
||||
Semicolon
|
||||
SingleQuote
|
||||
Slash
|
||||
SquareBracket
|
||||
```
|
||||
Examples:
|
||||
|
||||
Char maps:
|
||||
|
||||
```text
|
||||
IBM-Code-Page-037
|
||||
IBM-Code-Page-437
|
||||
IBM-Code-Page-850
|
||||
IBM-Code-Page-852
|
||||
IBM-Code-Page-855
|
||||
Windows-Code-Page-858
|
||||
IBM-Code-Page-860
|
||||
IBM-Code-Page-862
|
||||
IBM-Code-Page-863
|
||||
IBM-Code-Page-865
|
||||
IBM-Code-Page-866
|
||||
IBM-Code-Page-1047
|
||||
IBM-Code-Page-1140
|
||||
ISO-8859-1
|
||||
ISO-8859-2
|
||||
ISO-8859-3
|
||||
ISO-8859-4
|
||||
ISO-8859-5
|
||||
ISO-8859-6
|
||||
ISO-8859-7
|
||||
ISO-8859-8
|
||||
ISO-8859-9
|
||||
ISO-8859-10
|
||||
ISO-8859-13
|
||||
ISO-8859-14
|
||||
ISO-8859-15
|
||||
ISO-8859-16
|
||||
KOI8-R
|
||||
KOI8-U
|
||||
Macintosh
|
||||
Macintosh-Cyrillic
|
||||
Windows-874
|
||||
Windows-1250
|
||||
Windows-1251
|
||||
Windows-1252
|
||||
Windows-1253
|
||||
Windows-1254
|
||||
Windows-1255
|
||||
Windows-1256
|
||||
Windows-1257
|
||||
Windows-1258
|
||||
X-User-Defined
|
||||
```
|
||||
|
||||
Encoding masks:
|
||||
|
||||
```text
|
||||
Asterisk
|
||||
BackQuote
|
||||
BackSlash
|
||||
Colon
|
||||
CrLf
|
||||
Ctl
|
||||
Del
|
||||
Dollar
|
||||
Dot
|
||||
DoubleQuote
|
||||
Exclamation
|
||||
Hash
|
||||
InvalidUtf8
|
||||
LeftCrLfHtVt
|
||||
LeftPeriod
|
||||
LeftSpace
|
||||
LeftTilde
|
||||
LtGt
|
||||
None
|
||||
Percent
|
||||
Pipe
|
||||
Question
|
||||
Raw
|
||||
RightCrLfHtVt
|
||||
RightPeriod
|
||||
RightSpace
|
||||
Semicolon
|
||||
SingleQuote
|
||||
Slash
|
||||
SquareBracket
|
||||
```
|
||||
|
||||
Examples:
|
||||
|
||||
```console
|
||||
rclone convmv "stories/The Quick Brown Fox!.txt" --name-transform "all,uppercase"
|
||||
// Output: STORIES/THE QUICK BROWN FOX!.TXT
|
||||
```
|
||||
|
||||
```
|
||||
```console
|
||||
rclone convmv "stories/The Quick Brown Fox!.txt" --name-transform "all,replace=Fox:Turtle" --name-transform "all,replace=Quick:Slow"
|
||||
// Output: stories/The Slow Brown Turtle!.txt
|
||||
```
|
||||
|
||||
```
|
||||
```console
|
||||
rclone convmv "stories/The Quick Brown Fox!.txt" --name-transform "all,base64encode"
|
||||
// Output: c3Rvcmllcw==/VGhlIFF1aWNrIEJyb3duIEZveCEudHh0
|
||||
```
|
||||
|
||||
```
|
||||
```console
|
||||
rclone convmv "c3Rvcmllcw==/VGhlIFF1aWNrIEJyb3duIEZveCEudHh0" --name-transform "all,base64decode"
|
||||
// Output: stories/The Quick Brown Fox!.txt
|
||||
```
|
||||
|
||||
```
|
||||
```console
|
||||
rclone convmv "stories/The Quick Brown 🦊 Fox Went to the Café!.txt" --name-transform "all,nfc"
|
||||
// Output: stories/The Quick Brown 🦊 Fox Went to the Café!.txt
|
||||
```
|
||||
|
||||
```
|
||||
```console
|
||||
rclone convmv "stories/The Quick Brown 🦊 Fox Went to the Café!.txt" --name-transform "all,nfd"
|
||||
// Output: stories/The Quick Brown 🦊 Fox Went to the Café!.txt
|
||||
```
|
||||
|
||||
```
|
||||
```console
|
||||
rclone convmv "stories/The Quick Brown 🦊 Fox!.txt" --name-transform "all,ascii"
|
||||
// Output: stories/The Quick Brown Fox!.txt
|
||||
```
|
||||
|
||||
```
|
||||
```console
|
||||
rclone convmv "stories/The Quick Brown Fox!.txt" --name-transform "all,trimsuffix=.txt"
|
||||
// Output: stories/The Quick Brown Fox!
|
||||
```
|
||||
|
||||
```
|
||||
```console
|
||||
rclone convmv "stories/The Quick Brown Fox!.txt" --name-transform "all,prefix=OLD_"
|
||||
// Output: OLD_stories/OLD_The Quick Brown Fox!.txt
|
||||
```
|
||||
|
||||
```
|
||||
```console
|
||||
rclone convmv "stories/The Quick Brown 🦊 Fox Went to the Café!.txt" --name-transform "all,charmap=ISO-8859-7"
|
||||
// Output: stories/The Quick Brown _ Fox Went to the Caf_!.txt
|
||||
```
|
||||
|
||||
```
|
||||
```console
|
||||
rclone convmv "stories/The Quick Brown Fox: A Memoir [draft].txt" --name-transform "all,encoder=Colon,SquareBracket"
|
||||
// Output: stories/The Quick Brown Fox: A Memoir [draft].txt
|
||||
```
|
||||
|
||||
```
|
||||
```console
|
||||
rclone convmv "stories/The Quick Brown 🦊 Fox Went to the Café!.txt" --name-transform "all,truncate=21"
|
||||
// Output: stories/The Quick Brown 🦊 Fox
|
||||
```
|
||||
|
||||
```
|
||||
```console
|
||||
rclone convmv "stories/The Quick Brown Fox!.txt" --name-transform "all,command=echo"
|
||||
// Output: stories/The Quick Brown Fox!.txt
|
||||
```
|
||||
|
||||
```
|
||||
```console
|
||||
rclone convmv "stories/The Quick Brown Fox!" --name-transform "date=-{YYYYMMDD}"
|
||||
// Output: stories/The Quick Brown Fox!-20250618
|
||||
// Output: stories/The Quick Brown Fox!-20251121
|
||||
```
|
||||
|
||||
```
|
||||
```console
|
||||
rclone convmv "stories/The Quick Brown Fox!" --name-transform "date=-{macfriendlytime}"
|
||||
// Output: stories/The Quick Brown Fox!-2025-06-18 0148PM
|
||||
// Output: stories/The Quick Brown Fox!-2025-11-21 0505PM
|
||||
```
|
||||
|
||||
```
|
||||
```console
|
||||
rclone convmv "stories/The Quick Brown Fox!.txt" --name-transform "all,regex=[\\.\\w]/ab"
|
||||
// Output: ababababababab/ababab ababababab ababababab ababab!abababab
|
||||
```
|
||||
|
||||
Multiple transformations can be used in sequence, applied in the order they are specified on the command line.
|
||||
The regex command generally accepts Perl-style regular expressions, the exact
|
||||
syntax is defined in the [Go regular expression reference](https://golang.org/pkg/regexp/syntax/).
|
||||
The replacement string may contain capturing group variables, referencing
|
||||
capturing groups using the syntax `$name` or `${name}`, where the name can
|
||||
refer to a named capturing group or it can simply be the index as a number.
|
||||
To insert a literal $, use $$.
|
||||
|
||||
Multiple transformations can be used in sequence, applied
|
||||
in the order they are specified on the command line.
|
||||
|
||||
The `--name-transform` flag is also available in `sync`, `copy`, and `move`.
|
||||
|
||||
# Files vs Directories
|
||||
## Files vs Directories
|
||||
|
||||
By default `--name-transform` will only apply to file names. The means only the leaf file name will be transformed.
|
||||
However some of the transforms would be better applied to the whole path or just directories.
|
||||
To choose which which part of the file path is affected some tags can be added to the `--name-transform`.
|
||||
By default `--name-transform` will only apply to file names. The means only the
|
||||
leaf file name will be transformed. However some of the transforms would be
|
||||
better applied to the whole path or just directories. To choose which which
|
||||
part of the file path is affected some tags can be added to the `--name-transform`.
|
||||
|
||||
| Tag | Effect |
|
||||
|------|------|
|
||||
@@ -250,42 +269,58 @@ To choose which which part of the file path is affected some tags can be added t
|
||||
| `dir` | Only transform name of directories - these may appear anywhere in the path |
|
||||
| `all` | Transform the entire path for files and directories |
|
||||
|
||||
This is used by adding the tag into the transform name like this: `--name-transform file,prefix=ABC` or `--name-transform dir,prefix=DEF`.
|
||||
This is used by adding the tag into the transform name like this:
|
||||
`--name-transform file,prefix=ABC` or `--name-transform dir,prefix=DEF`.
|
||||
|
||||
For some conversions using all is more likely to be useful, for example `--name-transform all,nfc`.
|
||||
For some conversions using all is more likely to be useful, for example
|
||||
`--name-transform all,nfc`.
|
||||
|
||||
Note that `--name-transform` may not add path separators `/` to the name. This will cause an error.
|
||||
Note that `--name-transform` may not add path separators `/` to the name.
|
||||
This will cause an error.
|
||||
|
||||
# Ordering and Conflicts
|
||||
## Ordering and Conflicts
|
||||
|
||||
* Transformations will be applied in the order specified by the user.
|
||||
* If the `file` tag is in use (the default) then only the leaf name of files will be transformed.
|
||||
* If the `dir` tag is in use then directories anywhere in the path will be transformed
|
||||
* If the `all` tag is in use then directories and files anywhere in the path will be transformed
|
||||
* Each transformation will be run one path segment at a time.
|
||||
* If a transformation adds a `/` or ends up with an empty path segment then that will be an error.
|
||||
* It is up to the user to put the transformations in a sensible order.
|
||||
* Conflicting transformations, such as `prefix` followed by `trimprefix` or `nfc` followed by `nfd`, are possible.
|
||||
* Instead of enforcing mutual exclusivity, transformations are applied in sequence as specified by the
|
||||
user, allowing for intentional use cases (e.g., trimming one prefix before adding another).
|
||||
* Users should be aware that certain combinations may lead to unexpected results and should verify
|
||||
transformations using `--dry-run` before execution.
|
||||
- Transformations will be applied in the order specified by the user.
|
||||
- If the `file` tag is in use (the default) then only the leaf name of files
|
||||
will be transformed.
|
||||
- If the `dir` tag is in use then directories anywhere in the path will be
|
||||
transformed
|
||||
- If the `all` tag is in use then directories and files anywhere in the path
|
||||
will be transformed
|
||||
- Each transformation will be run one path segment at a time.
|
||||
- If a transformation adds a `/` or ends up with an empty path segment then
|
||||
that will be an error.
|
||||
- It is up to the user to put the transformations in a sensible order.
|
||||
- Conflicting transformations, such as `prefix` followed by `trimprefix` or
|
||||
`nfc` followed by `nfd`, are possible.
|
||||
- Instead of enforcing mutual exclusivity, transformations are applied in
|
||||
sequence as specified by the user, allowing for intentional use cases
|
||||
(e.g., trimming one prefix before adding another).
|
||||
- Users should be aware that certain combinations may lead to unexpected
|
||||
results and should verify transformations using `--dry-run` before execution.
|
||||
|
||||
# Race Conditions and Non-Deterministic Behavior
|
||||
## Race Conditions and Non-Deterministic Behavior
|
||||
|
||||
Some transformations, such as `replace=old:new`, may introduce conflicts where multiple source files map to the same destination name.
|
||||
This can lead to race conditions when performing concurrent transfers. It is up to the user to anticipate these.
|
||||
* If two files from the source are transformed into the same name at the destination, the final state may be non-deterministic.
|
||||
* Running rclone check after a sync using such transformations may erroneously report missing or differing files due to overwritten results.
|
||||
Some transformations, such as `replace=old:new`, may introduce conflicts where
|
||||
multiple source files map to the same destination name. This can lead to race
|
||||
conditions when performing concurrent transfers. It is up to the user to
|
||||
anticipate these.
|
||||
|
||||
- If two files from the source are transformed into the same name at the
|
||||
destination, the final state may be non-deterministic.
|
||||
- Running rclone check after a sync using such transformations may erroneously
|
||||
report missing or differing files due to overwritten results.
|
||||
|
||||
To minimize risks, users should:
|
||||
* Carefully review transformations that may introduce conflicts.
|
||||
* Use `--dry-run` to inspect changes before executing a sync (but keep in mind that it won't show the effect of non-deterministic transformations).
|
||||
* Avoid transformations that cause multiple distinct source files to map to the same destination name.
|
||||
* Consider disabling concurrency with `--transfers=1` if necessary.
|
||||
* Certain transformations (e.g. `prefix`) will have a multiplying effect every time they are used. Avoid these when using `bisync`.
|
||||
|
||||
|
||||
- Carefully review transformations that may introduce conflicts.
|
||||
- Use `--dry-run` to inspect changes before executing a sync (but keep in mind
|
||||
that it won't show the effect of non-deterministic transformations).
|
||||
- Avoid transformations that cause multiple distinct source files to map to the
|
||||
same destination name.
|
||||
- Consider disabling concurrency with `--transfers=1` if necessary.
|
||||
- Certain transformations (e.g. `prefix`) will have a multiplying effect every
|
||||
time they are used. Avoid these when using `bisync`.
|
||||
|
||||
```
|
||||
rclone convmv dest:path --name-transform XXX [flags]
|
||||
@@ -306,7 +341,7 @@ See the [global flags page](/flags/) for global options not listed here.
|
||||
|
||||
Flags for anything which can copy a file
|
||||
|
||||
```
|
||||
```text
|
||||
--check-first Do all the checks before starting transfers
|
||||
-c, --checksum Check for changes with size & checksum (if available, or fallback to size only)
|
||||
--compare-dest stringArray Include additional server-side paths during comparison
|
||||
@@ -347,7 +382,7 @@ Flags for anything which can copy a file
|
||||
|
||||
Important flags useful for most commands
|
||||
|
||||
```
|
||||
```text
|
||||
-n, --dry-run Do a trial run with no permanent changes
|
||||
-i, --interactive Enable interactive mode
|
||||
-v, --verbose count Print lots more stuff (repeat for more)
|
||||
@@ -357,7 +392,7 @@ Important flags useful for most commands
|
||||
|
||||
Flags for filtering directory listings
|
||||
|
||||
```
|
||||
```text
|
||||
--delete-excluded Delete files on dest excluded from sync
|
||||
--exclude stringArray Exclude files matching pattern
|
||||
--exclude-from stringArray Read file exclude patterns from file (use - to read from stdin)
|
||||
@@ -387,12 +422,17 @@ Flags for filtering directory listings
|
||||
|
||||
Flags for listing directories
|
||||
|
||||
```
|
||||
```text
|
||||
--default-time Time Time to show if modtime is unknown for files and directories (default 2000-01-01T00:00:00Z)
|
||||
--fast-list Use recursive list if available; uses more memory but fewer transactions
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
<!-- markdownlint-capture -->
|
||||
<!-- markdownlint-disable ul-style line-length -->
|
||||
|
||||
* [rclone](/commands/rclone/) - Show help for rclone commands, flags and backends.
|
||||
|
||||
|
||||
<!-- markdownlint-restore -->
|
||||
|
||||
Reference in New Issue
Block a user