
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Batch rename files and folders.
Install node then:
$ npm install -g renamer
Linux/Mac users may need to run the above with sudo
renamer
Batch rename files and folders.
Usage
$ renamer <options> <files>
-f, --find <string> The find string, or regular expression when --regex is set. If not set, the whole filename will be replaced.
-r, --replace <string> The replace string. With --regex set, --replace can reference parenthesised substrings from --find with $1, $2, $3
etc. If omitted, defaults to a blank string. The special token '{{index}}' will insert an incrementing number per
file processed.
-e, --regex When set, --find is intepreted as a regular expression.
-d, --dry-run Used for test runs. Set this to do everything but rename the file.
-i, --insensitive Enable case-insensitive finds.
-v, --verbose Use to print additional information.
-h, --help Print usage instructions.
for more detailed instructions, visit https://github.com/75lb/renamer
For more information on Regular Expressions, see this useful guide.
Don't forget to test your rename first using --dry-run
!
Renamer comes with globbing support built in (provided by node-glob), enabling recursive operations. To recurse, use the **
wildcard where a directory name would appear to apply the meaning "any directory, including this one".
For example, this command operates on all js files in the current directory:
$ renamer --find this --replace that '*.js'
this command operates on all js files, recursively:
$ renamer --find this --replace that '**/*.js'
this command operates on all js files from the lib
directory downward:
$ renamer --find this --replace that 'lib/**/*.js'
Bash users without globstar will need to enclose the glob expression in quotes to prevent native file expansion, i.e. '**/*.js'
Some real-world examples.
Windows users: the single-quotation marks used in the example commands below are for bash (Mac/Linux) users, please replace these with double-quotation marks on Windows.
$ renamer --find '[bad]' --replace '[good]' *
Before | After |
---|---|
|
|
$ renamer --insensitive --find 'mpeg4' --replace 'mp4' *
Before | After |
---|---|
|
|
$ renamer --find 'Season 1 - ' *
Before | After |
---|---|
|
|
$ renamer --regex --find '.*_(\d+)_.*' --replace 'Video $1.mp4' *
Before | After |
---|---|
|
|
$ renamer --replace 'Image{{index}}.jpg' *
Before | After |
---|---|
|
|
$ renamer --regex --find '\.(?!\w+$)' --replace ' ' *
Before | After |
---|---|
|
|
$ renamer --regex --find '(data\d)(\.\w+)' --replace '$1 (checked by Lloyd)$2' *
Before | After |
---|---|
|
|
$ renamer --find 'pic' --replace 'photo' '**'
Before | After |
---|---|
|
|
$ renamer --regex --find '^' --replace 'good-' '**'
Before | After |
---|---|
|
|
© 2012-16 Lloyd Brookes <75pound@gmail.com>. Documented by jsdoc-to-markdown.
FAQs
Rename files in bulk
The npm package renamer receives a total of 11,575 weekly downloads. As such, renamer popularity was classified as popular.
We found that renamer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.