Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
NPM utility module to rename files/folders using regular expressions.
CoffeeScript Ruby JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
.gitignore
README.md
package.json
rexname.coffee

README.md

rexname

NPM utility module to rename files using regular expressions.

Installation

Install globally via NPM

npm install -g rexname

Usage

rexname <search> <replace>
  • search: a string or regular expression to match files on. e.g. .txt or '/(.*)\.\d{4}/i' (Use quotes when for special characters or spaces)
  • replace: a string used to replace file names. Use $1 $2... for matched text. e.g. 'new $1.$2'

Example

filenames

file1_201208.txt
file2_201209.txt

rexname command

rexname '/file(\d+)_(\d{4})(\d{2}).txt/i' '$3-$2-module-$1.js'

result

2012-08-module-1.js
2012-09-module-2.js
Something went wrong with that request. Please try again.