mirror of
https://github.com/rclone/rclone.git
synced 2025-12-10 05:13:45 +00:00
lib/transform adds the transform library, supporting advanced path name transformations for converting and renaming files and directories by applying prefixes, suffixes, and other alterations. It also adds the --name-transform flag for use with sync, copy, and move. Multiple transformations can be used in sequence, applied in the order they are specified on the command line. 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: file Only transform the leaf name of files (DEFAULT) dir Only transform name of directories - these may appear anywhere in the path all Transform the entire path for files and directories Example syntax: --name-transform file,prefix=ABC --name-transform dir,prefix=DEF
15 lines
384 B
Go
15 lines
384 B
Go
// Package transformflags implements command line flags to set up a transform
|
|
package transformflags
|
|
|
|
import (
|
|
"github.com/rclone/rclone/fs/config/flags"
|
|
"github.com/rclone/rclone/lib/transform"
|
|
|
|
"github.com/spf13/pflag"
|
|
)
|
|
|
|
// AddFlags adds the transform flags to the command
|
|
func AddFlags(flagSet *pflag.FlagSet) {
|
|
flags.AddFlagsFromOptions(flagSet, "", transform.OptionsInfo)
|
|
}
|