Skip to content

✏️ Script for recursively renaming files and folders

Notifications You must be signed in to change notification settings

mateja176/rename

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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"] }'

About

✏️ Script for recursively renaming files and folders

Resources

Stars

Watchers

Forks

Packages

No packages published