{"id":13525616,"url":"https://github.com/75lb/renamer","last_synced_at":"2025-05-15T23:08:11.438Z","repository":{"id":5964231,"uuid":"7185672","full_name":"75lb/renamer","owner":"75lb","description":"Rename files in bulk.","archived":false,"fork":false,"pushed_at":"2024-02-03T13:23:10.000Z","size":646,"stargazers_count":495,"open_issues_count":3,"forks_count":30,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-05-15T17:11:45.394Z","etag":null,"topics":["batch","command-line-app","command-line-tool","cross-platform","file","filesystem","glob-pattern","javascript","javascript-library","move","nodejs","regular-expression","rename","rename-files","renamer"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/75lb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-12-16T00:36:23.000Z","updated_at":"2024-06-04T13:56:40.134Z","dependencies_parsed_at":"2022-08-06T19:01:01.736Z","dependency_job_id":"329120db-a13b-4890-b62e-d392d54eeb76","html_url":"https://github.com/75lb/renamer","commit_stats":{"total_commits":331,"total_committers":4,"mean_commits":82.75,"dds":"0.012084592145015116","last_synced_commit":"7cd4b5790c5fbcfb977e442108d7732bc0561a13"},"previous_names":[],"tags_count":64,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Frenamer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Frenamer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Frenamer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Frenamer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/75lb","download_url":"https://codeload.github.com/75lb/renamer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254436949,"owners_count":22070947,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["batch","command-line-app","command-line-tool","cross-platform","file","filesystem","glob-pattern","javascript","javascript-library","move","nodejs","regular-expression","rename","rename-files","renamer"],"created_at":"2024-08-01T06:01:20.438Z","updated_at":"2025-05-15T23:08:06.302Z","avatar_url":"https://github.com/75lb.png","language":"JavaScript","readme":"[![view on npm](https://badgen.net/npm/v/renamer)](https://www.npmjs.org/package/renamer)\n[![npm module downloads](https://badgen.net/npm/dt/renamer)](https://www.npmjs.org/package/renamer)\n[![Gihub repo dependents](https://badgen.net/github/dependents-repo/75lb/renamer)](https://github.com/75lb/renamer/network/dependents?dependent_type=REPOSITORY)\n[![Gihub package dependents](https://badgen.net/github/dependents-pkg/75lb/renamer)](https://github.com/75lb/renamer/network/dependents?dependent_type=PACKAGE)\n[![Node.js CI](https://github.com/75lb/renamer/actions/workflows/node.js.yml/badge.svg)](https://github.com/75lb/renamer/actions/workflows/node.js.yml)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)\n\n***Upgraders, please read the [release notes](https://github.com/75lb/renamer/releases). Please share feedback and improvement ideas [here](https://github.com/75lb/renamer/discussions).***\n\n# renamer\n\nRenamer is a command-line utility to help rename files and folders. It is flexible and extensible via plugins.\n\n## Disclaimer\n\nAlways run this tool with the `--dry-run` option until you are confident the results look correct.\n\n## Synopsis\n\n_The examples below use double quotes to suit Windows users. MacOS \u0026 Linux users should use single quotes._\n\n\nAs input, renamer takes a list of filenames or glob patterns plus some options describing how you would like the files to be renamed.\n\n```\n$ renamer [options] [file...]\n```\n\nThis trivial example will replace the text `jpeg` with `jpg` in all file and directory names in the current directory.\n\n```\n$ renamer --find jpeg --replace jpg *\n```\n\nAs above but operates on all files and folders recursively.\n\n```\n$ renamer --find jpeg --replace jpg \"**\"\n```\n\n### Fine-tune which files to process\n\nIf no filenames or patterns are specified, renamer will look for a newline-separated list of filenames on standard input. This approach is useful for crafting a specific input list using tools like `find`. This example operates on files modified less than 20 minutes ago.\n\n```\n$ find . -mtime -20m | renamer --find jpeg --replace jpg\n```\n\nSame again but with a hand-rolled input of filenames and glob patterns. Create an input text file, e.g. `files.txt`:\n\n```\nhouse.jpeg\ngarden.jpeg\nimg/*\n```\n\nThen pipe it into renamer.\n\n```\n$ cat files.txt | renamer --find jpeg --replace jpg\n```\n\n### Rename using regular expressions\n\nSimple example using a [regular expression literal](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions). The case-insensitive pattern `/one/i` matches the input file `ONE.jpg`, renaming it to `two.jpg`.\n\n```\n$ renamer --find \"/one/i\" --replace \"two\" ONE.jpg\n```\n\n### Rename using JavaScript\n\nFor more complex renames, or if you just prefer using code, you can write a [replace function](https://github.com/75lb/renamer/wiki/How-to-write-a-replace-chain-plugin). Create a module exporting a class which defines a `replace` method. This trivial example appends the text `[DONE]` to each file name.\n\n```js\nimport path from 'path'\n\nclass Suffix {\n  replace (filePath) {\n    const file = path.parse(filePath)\n    const newName = file.name + ' [DONE]' + file.ext\n    return path.join(file.dir, newName)\n  }\n}\n\nexport default Suffix\n```\n\nSave the above as `suffix.js` then process all files in the current directory using the above plugin as the replace chain.\n\n```\n$ renamer --dry-run --chain suffix.js *\n\nDry run\n\n✔︎ pic1.jpg → pic1 [DONE].jpg\n✔︎ pic2.jpg → pic2 [DONE].jpg\n\nRename complete: 2 of 6 files renamed.\n```\n\n## Views\n\nThe following gif demonstrates the default view (with and without `--verbose` mode), the built-in alternative views (`long`, `diff` and `one-line`) and a [custom view](https://github.com/75lb/renamer/tree/master/example/view).\n\n\u003cimg src=\"https://i.imgur.com/7830Y9N.gif\" width=\"620px\" title=\"Renamer views demo\"\u003e\n\n## Further reading\n\nPlease see [the wiki](https://github.com/75lb/renamer/wiki) for\n\n* [Usage examples](https://github.com/75lb/renamer/wiki/examples).\n*  More information about [using plugins](https://github.com/75lb/renamer/wiki/How-to-use-replace-chain-plugins) and [writing plugins](https://github.com/75lb/renamer/wiki/How-to-write-a-replace-chain-plugin).\n* The [full list of command-line options](https://github.com/75lb/renamer/wiki/Renamer-CLI-docs).\n\nFor more information on Regular Expressions, see [this useful guide](https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions).\n\n## Install\n\nFirst, ensure [Node.js](https://nodejs.org/en/) v14 or above is installed.\n\nTo install renamer globally as a part of your regular command-line tool kit:\n\n```\n$ npm install --global renamer\n```\n\nTo install renamer as a development dependency of your project: \n\n```\n$ npm install --save-dev renamer\n```\n\n* * *\n\n\u0026copy; 2012-25 Lloyd Brookes \\\u003copensource@75lb.com\\\u003e.\n\nTested by [test-runner](https://github.com/test-runner-js/test-runner).\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F75lb%2Frenamer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F75lb%2Frenamer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F75lb%2Frenamer/lists"}