2.0.0 • Published 5 years ago

rename-recursively v2.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

Rename

✏️ Script for renaming and recursively renaming files and folders

To do

Add --depth option to be used in conjunction with the recursive flag

Usage

npm i -g mateja176/rename

rename --help

Examples

Rename all '.js' files to '.ts' files in the src directory

rename --path src --find '(.+)\.js' --replace '$1.ts' --recursive

Be careful when using the --recursive flag. It can affect many assets at once and you may find it difficult if not impossible to undo a recursive rename in cases where the rename was informationally destructive

Transformations

Available Transformations

'toUpperCase' | 'toLowerCase' | 'trim' | 'trimLeft' | 'trimRight';

Examples with Transformations

Trimming file names

rename --find '.+' --replace '$&' --transformations '{ "$&": ["trim"] }' --recursive
rename --find '(.+)(\.ts)' --replace '$1$2' --transformations '{ "$1": ["trim"] }"

Lower casing file names

rename --find '.+' --replace '$&' --transformations '{ "$&": ["toLowerCase"] }'