First read the API docs.
Assuming your current folder looks like this:
pics ├── pic1.jpg ├── pic2.jpg
Running this script...
import Renamer from 'renamer' const renamer = new Renamer() const options = { files: ['pics/*'], find: 'pic', replace: 'photo', dryRun: true } for await (const result of renamer.results(options)) { console.log(result) }
...will result in the following output.
$ node example.mjs { from: 'pics/pic1.jpg', to: 'pics/photo1.jpg', renamed: true } { from: 'pics/pic2.jpg', to: 'pics/photo2.jpg', renamed: true }
Remove the dryRun: true flag to complete the renames on disk.
dryRun: true
There was an error while loading. Please reload this page.