https://github.com/75lb/renamer-index-dir
Replaces the `{{index}}` token, resetting the counter for each folder visited.
https://github.com/75lb/renamer-index-dir
plugin renamer
Last synced: 6 months ago
JSON representation
Replaces the `{{index}}` token, resetting the counter for each folder visited.
- Host: GitHub
- URL: https://github.com/75lb/renamer-index-dir
- Owner: 75lb
- License: mit
- Created: 2018-07-15T23:16:14.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2021-05-18T12:56:43.000Z (about 5 years ago)
- Last Synced: 2025-11-03T22:21:17.171Z (9 months ago)
- Topics: plugin, renamer
- Language: JavaScript
- Homepage:
- Size: 90.8 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://www.npmjs.org/package/renamer-index-dir)
[](https://www.npmjs.org/package/renamer-index-dir)
[](https://github.com/75lb/renamer-index-dir/network/dependents?dependent_type=REPOSITORY)
[](https://github.com/75lb/renamer-index-dir/network/dependents?dependent_type=PACKAGE)
[](https://travis-ci.org/75lb/renamer-index-dir)
[](https://coveralls.io/github/75lb/renamer-index-dir)
[](https://github.com/feross/standard)
# renamer-index-dir
This is a [renamer](https://github.com/75lb/renamer) replace chain plugin - see [this tutorial](https://github.com/75lb/renamer/wiki/How-to-use-replace-chain-plugins) to learn how to use renamer plugins.
Replaces the `{{index}}` token (like the [built-in renamer behaviour](https://github.com/75lb/renamer/wiki/Examples#index-token-examples)) but resets the counter for each folder visited.
_In the example below, Windows users should use double instead of single quotes._ Remove the `--dry-run` flag to rename the files on disk.
```
$ npm install -g renamer renamer-index-dir
$ tree
.
├── folder1
│ ├── one
│ └── two
├── folder2
│ ├── one
│ └── two
├── one
└── two
2 directories, 6 files
$ renamer --chain find-replace --chain renamer-index-dir --find '/$/' --replace '{{index}}' --dry-run */*
✔︎ folder1/one → folder1/one1
✔︎ folder1/two → folder1/two2
✔︎ folder2/one → folder2/one1
✔︎ folder2/two → folder2/two2
$ tree
.
├── folder1
│ ├── one1
│ └── two2
├── folder2
│ ├── one1
│ └── two2
├── one
└── two
2 directories, 6 files
```
* * *
© 2018-21 Lloyd Brookes <75pound@gmail.com>.