ren4

rename files or folders

Usage no npm install needed!

<script type="module">
  import ren4 from 'https://cdn.skypack.dev/ren4';
</script>

README

ren4

An application for rename files or folders by using regular expressions.

reference: Rust version ren3

Install

You’ll need to have Node 10.0.0 or later version

npx

> npx ren4 's/.\*(\d+\.txt)/bar-$1'

package.json

npm install ren4 --save-dev

This will allow using ren4 in your package.json scripts.

{
  "scripts": {
    "rename": "ren4 \"s/.*(\d+\.txt)/foo-$1\" dist"
  }
}

Usage

Usage: ren4 [options] <expression> [directory]

An application for rename files or folders by using regular expressions

Arguments:
  expression       sed regex expression
  directory        target directory

Options:
  -r, --recursive  recursively rename files
  -h, --help       display help for command

Examples

> touch foo-1.txt foo2.txt

> ls
foo-1.txt  foo2.txt

> ren4 's/.*(\d+\.txt)/bar-$1'
[OK] dist/foo-1.txt     -> dist/bar-1.txt
[OK] dist/foo2.txt      -> dist/bar-2.txt

> ls
bar-1.txt  bar-2.txt