# multi-rename
[](https://img.shields.io/pypi/v/multi-rename?color=blue)
[](https://img.shields.io/github/v/release/pshkrh/multi-rename)
[](https://img.shields.io/pypi/l/multi-rename)
A python module for renaming multiple files in a directory to a common format ending with incrementing numbers. The increment start and gap between increments is configurable, and a separator string can be specified to be inserted between the new name and the incrementing number.
It also supports adding a prefix or suffix to each file in a directory, with options for a separator strings.
For both full renaming and prefix / suffix renaming, a list of file extensions can be provided as a filter to ignore these files for renaming.
## Installation
Install using pip:
```sh
pip install multi-rename
```
## Usage
```Python
from multi_rename import renamer
# Fully rename all the files with incrementing file numbers, exlcuding any html files
renamer.full_rename(dir_path='/path/to/dir/here', new_name='new_file_name', filter_ext='html')
# Add a prefix to all the files with an underscore separator, excluding any txt files
renamer.add_prefix(dir_path='/path/to/dir/here', prefix='prefix_to_add', sep='_', filter_ext='txt')
# Add a suffix to all the files with a hyphen separator, excluding any pdf files
renamer.add_suffix(dir_path='/path/to/dir/here', suffix='suffix_to_add', sep='-', filter_ext='pdf')
```
## Example
### Folder structure with sample files
```md
expenses.xlsx
report.pdf
essay.docx
webpage.html
...
```
### Full rename
```Python
renamer.full_rename(dir_path='/home/dir_path/', new_name='print-this', sep='-')
```
This will rename all the file names in `dir_path` to `print-this` followed by a hyphen and incrementing numbers:
```md
print-this-1.xlsx
print-this-2.pdf
print-this-3.docx
print-this-4.html
...
```
### Adding a prefix
```Python
renamer.add_prefix(dir_path='/home/dir_path/', prefix='v1', sep='-')
```
This will rename all the file names in `dir_path` to start with `v1-`:
```md
v1-expenses.xlsx
v1-report.pdf
v1-essay.docx
v1-webpage.html
...
```
### Adding a suffix
```Python
renamer.add_suffix(dir_path='/home/dir_path/', suffix='old', sep='_')
```
This will rename all the file names in `dir_path` to end with `_old`:
```md
expenses_old.xlsx
report_old.pdf
essay_old.docx
webpage_old.html
...
```
### Changing file extensions
```Python
renamer.change_extension(dir_path='/home/dir_path/', new_ext='txt', filter_ext='html')
```
This will change all the file extensions in `dir_path` to `.txt`, except any `.html` files:
```md
expenses.txt
report.txt
essay.txt
webpage.html
...
```
## Contributing
If you have any bug fixes / useful feature additions, feel free to fork this repository, make your changes and drop in a pull request.
## License
[MIT](https://github.com/pshkrh/multi-rename/blob/master/LICENSE)
Raw data
{
"_id": null,
"home_page": "https://github.com/pshkrh/multi-rename",
"name": "multi-rename",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.3",
"maintainer_email": "",
"keywords": "multi batch rename all files",
"author": "Pushkar Kurhekar",
"author_email": "contact@pshkrh.com",
"download_url": "https://files.pythonhosted.org/packages/4e/94/5002f61ccd45da37975b604b6e6ada6d59918bee0d73b43be93bb1d22cfe/multi-rename-0.0.4.tar.gz",
"platform": null,
"description": "# multi-rename\n\n[](https://img.shields.io/pypi/v/multi-rename?color=blue)\n[](https://img.shields.io/github/v/release/pshkrh/multi-rename)\n[](https://img.shields.io/pypi/l/multi-rename)\n\nA python module for renaming multiple files in a directory to a common format ending with incrementing numbers. The increment start and gap between increments is configurable, and a separator string can be specified to be inserted between the new name and the incrementing number.\n\nIt also supports adding a prefix or suffix to each file in a directory, with options for a separator strings.\n\nFor both full renaming and prefix / suffix renaming, a list of file extensions can be provided as a filter to ignore these files for renaming.\n\n## Installation\n\nInstall using pip:\n\n```sh\npip install multi-rename\n```\n\n## Usage\n\n```Python\nfrom multi_rename import renamer\n\n# Fully rename all the files with incrementing file numbers, exlcuding any html files\nrenamer.full_rename(dir_path='/path/to/dir/here', new_name='new_file_name', filter_ext='html')\n\n# Add a prefix to all the files with an underscore separator, excluding any txt files\nrenamer.add_prefix(dir_path='/path/to/dir/here', prefix='prefix_to_add', sep='_', filter_ext='txt')\n\n# Add a suffix to all the files with a hyphen separator, excluding any pdf files\nrenamer.add_suffix(dir_path='/path/to/dir/here', suffix='suffix_to_add', sep='-', filter_ext='pdf')\n\n```\n\n## Example\n\n### Folder structure with sample files\n```md\nexpenses.xlsx\nreport.pdf\nessay.docx\nwebpage.html\n...\n```\n\n### Full rename\n```Python\nrenamer.full_rename(dir_path='/home/dir_path/', new_name='print-this', sep='-')\n```\n\nThis will rename all the file names in `dir_path` to `print-this` followed by a hyphen and incrementing numbers:\n\n```md\nprint-this-1.xlsx\nprint-this-2.pdf\nprint-this-3.docx\nprint-this-4.html\n...\n```\n\n### Adding a prefix\n```Python\nrenamer.add_prefix(dir_path='/home/dir_path/', prefix='v1', sep='-')\n```\n\nThis will rename all the file names in `dir_path` to start with `v1-`:\n\n```md\nv1-expenses.xlsx\nv1-report.pdf\nv1-essay.docx\nv1-webpage.html\n...\n```\n\n### Adding a suffix\n```Python\nrenamer.add_suffix(dir_path='/home/dir_path/', suffix='old', sep='_')\n```\n\nThis will rename all the file names in `dir_path` to end with `_old`:\n\n```md\nexpenses_old.xlsx\nreport_old.pdf\nessay_old.docx\nwebpage_old.html\n...\n```\n\n### Changing file extensions\n```Python\nrenamer.change_extension(dir_path='/home/dir_path/', new_ext='txt', filter_ext='html')\n```\n\nThis will change all the file extensions in `dir_path` to `.txt`, except any `.html` files:\n\n```md\nexpenses.txt\nreport.txt\nessay.txt\nwebpage.html\n...\n```\n\n## Contributing\n\nIf you have any bug fixes / useful feature additions, feel free to fork this repository, make your changes and drop in a pull request.\n\n## License\n\n[MIT](https://github.com/pshkrh/multi-rename/blob/master/LICENSE)\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "Easily rename multiple files ending with incrementing numbers.",
"version": "0.0.4",
"split_keywords": [
"multi",
"batch",
"rename",
"all",
"files"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "904c967db113517fd42e174350380d60",
"sha256": "cbe42d4303040caef2e9b1a1b81491852b1f276a0c6bba16dde8aa2816591add"
},
"downloads": -1,
"filename": "multi_rename-0.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "904c967db113517fd42e174350380d60",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.3",
"size": 5758,
"upload_time": "2022-05-14T13:11:56",
"upload_time_iso_8601": "2022-05-14T13:11:56.724500Z",
"url": "https://files.pythonhosted.org/packages/4b/a9/6dde64b59d444a23bb41941f79d8f83d88f89d1990535202cc3a9976884a/multi_rename-0.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "b1c4765d851f140f00832a8be16b1000",
"sha256": "d0f6893b39082f577875d7e3dcc9a2ae7f30e5bb44113b155218ab0a8266fbc1"
},
"downloads": -1,
"filename": "multi-rename-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "b1c4765d851f140f00832a8be16b1000",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.3",
"size": 4316,
"upload_time": "2022-05-14T13:11:58",
"upload_time_iso_8601": "2022-05-14T13:11:58.813574Z",
"url": "https://files.pythonhosted.org/packages/4e/94/5002f61ccd45da37975b604b6e6ada6d59918bee0d73b43be93bb1d22cfe/multi-rename-0.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-05-14 13:11:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "pshkrh",
"github_project": "multi-rename",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "multi-rename"
}