rename-clean


Namerename-clean JSON
Version 1.2 PyPI version JSON
download
home_pageNone
SummaryUtility to replace undesirable characters in Linux file names
upload_time2025-08-15 21:34:44
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords rename mv
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## RENAME-CLEAN - Replace Undesirable Characters in Linux File Names
[![PyPi](https://img.shields.io/pypi/v/rename-clean)](https://pypi.org/project/rename-clean/)

The [`rename-clean`][rename-clean] command line utility replaces undesirable
characters with underscores in Linux file names. Undesirable characters are any
that are not ASCII alphanumeric (`0-9`, `a-z`, `A-Z`), underscore (`_`), hyphen
(`-`), or dot (`.`). If characters are replaced, then repeated underscores are
also reduced to a single underscore and trimmed from the name stem and suffix.
A unique name is always created by appending a number on the name stem if
necessary.

I use it after downloading an archive of files from the internet such as a
torrent to remove spaces, emojis, and other odd characters from the file names.

Example usage follows:

Clean up all file and directory names in the current directory:

```sh
$ rename-clean (or rename-clean .)
```

Clean up all file and directory names in the current directory and recursively
under any child directories:

```sh
$ rename-clean -r
```

Clean up all all jpeg file names in current directory:

```sh
$ rename-clean *.jpg
```

Read a list of names to be cleaned up from a file:

```sh
$ rename-clean - <list-of-bad-file-names.txt
```

Clean up all file and directory names, but also allow `+` and `%` characters in
names. Note you can allow extra characters by default using the `-a/--add`
option as described in the [Command Default Options](#command-default-options)
section below:

```sh
$ rename-clean -a '+%'
```

You can run with the `-d/--dryrun` option to see what would be changed without
actually renaming anything.

The latest version and documentation is available at
https://github.com/bulletmark/rename-clean.

## Command Default Options

You can add default options to a personal configuration file
`~/.config/rename-clean-flags.conf`. If that file exists then each line of
options will be concatenated and automatically prepended to your `rename-clean`
command line arguments. Comments in the file (i.e. starting with a `#`) are
ignored. Type `rename-clean -h` to see all [supported
options](#command-line-options).

## Installation or Upgrade

Python 3.8 or later is required. Note [`rename-clean` is on
PyPI](https://pypi.org/project/rename-clean/) so the easiest way to install it is to
use [`uv tool`][uvtool].

```sh
$ uv tool install rename-clean
```

To upgrade:

```sh
$ uv tool upgrade rename-clean
```

To uninstall:

```sh
$ uv tool uninstall rename-clean
```

Alternatively, run it immediately using [`uvx`][uvx] without explicit
installation by typing `uvx rename-clean`.

## Command Line Options

Type `rename-clean -h` to view the usage summary:

```
usage: rename-clean [-h] [-r] [-d] [-q] [-i] [-s] [-m] [-c CHARACTER]
                       [-a ADD]
                       [path ...]

Utility to replace undesirable characters with underscores in Linux file
names. Undesirable characters are any that are not ASCII alphanumeric (`0-9`,
`a-z`, `A-Z`), underscore (`_`), hyphen (`-`), or dot (`.`). If characters are
replaced, then repeated underscores are also reduced to a single underscore
and trimmed from the name stem and suffix. A unique name is always created by
appending a number on the name stem if necessary.

positional arguments:
  path                  one or more file or directory names to rename, or "-"
                        to read names from stdin. Default is all files in
                        current directory if no path given.

options:
  -h, --help            show this help message and exit
  -r, --recurse         recurse through all sub directories
  -d, --dryrun          do not rename, just show what would be done
  -q, --quiet           do not report changes
  -i, --ignore-hidden   ignore hidden files and directories (those starting
                        with ".")
  -s, --recurse-symlinks
                        recurse into symbolic directory links, default is to
                        rename a link but not recurse into it
  -m, --more-aggressive
                        Replace underscores even if deletions have not been
                        done
  -c, --character CHARACTER
                        character to replace undesirable characters with,
                        default = "_"
  -a, --add ADD         additional characters to allow in names, e.g. "+%"
                        (default: only alphanumeric, "_", "-", and ".")

Note you can set default options in $HOME/.config/rename_clean-flags.conf
```

## License

Copyright (C) 2025 Mark Blakeney. This program is distributed under the
terms of the GNU General Public License. This program is free software:
you can redistribute it and/or modify it under the terms of the GNU
General Public License as published by the Free Software Foundation,
either version 3 of the License, or any later version. This program is
distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License at
<https://en.wikipedia.org/wiki/GNU_General_Public_License> for more details.

[rename-clean]: https://github.com/bulletmark/rename-clean
[uvtool]: https://docs.astral.sh/uv/guides/tools/#installing-tools
[uvx]: https://docs.astral.sh/uv/guides/tools/#running-tools

<!-- vim: se ai syn=markdown: -->

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "rename-clean",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "rename, mv",
    "author": null,
    "author_email": "Mark Blakeney <mark.blakeney@bullet-systems.net>",
    "download_url": "https://files.pythonhosted.org/packages/a8/96/2c2755c7048355e3edef36989f88ce8b7775776467d8f95a9e650f472509/rename_clean-1.2.tar.gz",
    "platform": null,
    "description": "## RENAME-CLEAN - Replace Undesirable Characters in Linux File Names\n[![PyPi](https://img.shields.io/pypi/v/rename-clean)](https://pypi.org/project/rename-clean/)\n\nThe [`rename-clean`][rename-clean] command line utility replaces undesirable\ncharacters with underscores in Linux file names. Undesirable characters are any\nthat are not ASCII alphanumeric (`0-9`, `a-z`, `A-Z`), underscore (`_`), hyphen\n(`-`), or dot (`.`). If characters are replaced, then repeated underscores are\nalso reduced to a single underscore and trimmed from the name stem and suffix.\nA unique name is always created by appending a number on the name stem if\nnecessary.\n\nI use it after downloading an archive of files from the internet such as a\ntorrent to remove spaces, emojis, and other odd characters from the file names.\n\nExample usage follows:\n\nClean up all file and directory names in the current directory:\n\n```sh\n$ rename-clean (or rename-clean .)\n```\n\nClean up all file and directory names in the current directory and recursively\nunder any child directories:\n\n```sh\n$ rename-clean -r\n```\n\nClean up all all jpeg file names in current directory:\n\n```sh\n$ rename-clean *.jpg\n```\n\nRead a list of names to be cleaned up from a file:\n\n```sh\n$ rename-clean - <list-of-bad-file-names.txt\n```\n\nClean up all file and directory names, but also allow `+` and `%` characters in\nnames. Note you can allow extra characters by default using the `-a/--add`\noption as described in the [Command Default Options](#command-default-options)\nsection below:\n\n```sh\n$ rename-clean -a '+%'\n```\n\nYou can run with the `-d/--dryrun` option to see what would be changed without\nactually renaming anything.\n\nThe latest version and documentation is available at\nhttps://github.com/bulletmark/rename-clean.\n\n## Command Default Options\n\nYou can add default options to a personal configuration file\n`~/.config/rename-clean-flags.conf`. If that file exists then each line of\noptions will be concatenated and automatically prepended to your `rename-clean`\ncommand line arguments. Comments in the file (i.e. starting with a `#`) are\nignored. Type `rename-clean -h` to see all [supported\noptions](#command-line-options).\n\n## Installation or Upgrade\n\nPython 3.8 or later is required. Note [`rename-clean` is on\nPyPI](https://pypi.org/project/rename-clean/) so the easiest way to install it is to\nuse [`uv tool`][uvtool].\n\n```sh\n$ uv tool install rename-clean\n```\n\nTo upgrade:\n\n```sh\n$ uv tool upgrade rename-clean\n```\n\nTo uninstall:\n\n```sh\n$ uv tool uninstall rename-clean\n```\n\nAlternatively, run it immediately using [`uvx`][uvx] without explicit\ninstallation by typing `uvx rename-clean`.\n\n## Command Line Options\n\nType `rename-clean -h` to view the usage summary:\n\n```\nusage: rename-clean [-h] [-r] [-d] [-q] [-i] [-s] [-m] [-c CHARACTER]\n                       [-a ADD]\n                       [path ...]\n\nUtility to replace undesirable characters with underscores in Linux file\nnames. Undesirable characters are any that are not ASCII alphanumeric (`0-9`,\n`a-z`, `A-Z`), underscore (`_`), hyphen (`-`), or dot (`.`). If characters are\nreplaced, then repeated underscores are also reduced to a single underscore\nand trimmed from the name stem and suffix. A unique name is always created by\nappending a number on the name stem if necessary.\n\npositional arguments:\n  path                  one or more file or directory names to rename, or \"-\"\n                        to read names from stdin. Default is all files in\n                        current directory if no path given.\n\noptions:\n  -h, --help            show this help message and exit\n  -r, --recurse         recurse through all sub directories\n  -d, --dryrun          do not rename, just show what would be done\n  -q, --quiet           do not report changes\n  -i, --ignore-hidden   ignore hidden files and directories (those starting\n                        with \".\")\n  -s, --recurse-symlinks\n                        recurse into symbolic directory links, default is to\n                        rename a link but not recurse into it\n  -m, --more-aggressive\n                        Replace underscores even if deletions have not been\n                        done\n  -c, --character CHARACTER\n                        character to replace undesirable characters with,\n                        default = \"_\"\n  -a, --add ADD         additional characters to allow in names, e.g. \"+%\"\n                        (default: only alphanumeric, \"_\", \"-\", and \".\")\n\nNote you can set default options in $HOME/.config/rename_clean-flags.conf\n```\n\n## License\n\nCopyright (C) 2025 Mark Blakeney. This program is distributed under the\nterms of the GNU General Public License. This program is free software:\nyou can redistribute it and/or modify it under the terms of the GNU\nGeneral Public License as published by the Free Software Foundation,\neither version 3 of the License, or any later version. This program is\ndistributed in the hope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License at\n<https://en.wikipedia.org/wiki/GNU_General_Public_License> for more details.\n\n[rename-clean]: https://github.com/bulletmark/rename-clean\n[uvtool]: https://docs.astral.sh/uv/guides/tools/#installing-tools\n[uvx]: https://docs.astral.sh/uv/guides/tools/#running-tools\n\n<!-- vim: se ai syn=markdown: -->\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Utility to replace undesirable characters in Linux file names",
    "version": "1.2",
    "project_urls": {
        "Homepage": "https://github.com/bulletmark/rename-clean"
    },
    "split_keywords": [
        "rename",
        " mv"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f01bf9943337d53b9a9e3807e61739a7d898ae033003fdfd9a6fbf1ce8050493",
                "md5": "4604453bb5588caad5c6939f0dddef3f",
                "sha256": "3f1e245fc1780dcf2d5e959141cfba8ff5cc30238d1738f99a10cf70e1a8b29b"
            },
            "downloads": -1,
            "filename": "rename_clean-1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4604453bb5588caad5c6939f0dddef3f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 5860,
            "upload_time": "2025-08-15T21:34:43",
            "upload_time_iso_8601": "2025-08-15T21:34:43.525834Z",
            "url": "https://files.pythonhosted.org/packages/f0/1b/f9943337d53b9a9e3807e61739a7d898ae033003fdfd9a6fbf1ce8050493/rename_clean-1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a8962c2755c7048355e3edef36989f88ce8b7775776467d8f95a9e650f472509",
                "md5": "612ab4ed3e3f5972a291f20a45321481",
                "sha256": "c94f144a3e40ee10774b903eaca1bcd11925892514c010c88f79b6b42c5394ac"
            },
            "downloads": -1,
            "filename": "rename_clean-1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "612ab4ed3e3f5972a291f20a45321481",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 5817,
            "upload_time": "2025-08-15T21:34:44",
            "upload_time_iso_8601": "2025-08-15T21:34:44.514367Z",
            "url": "https://files.pythonhosted.org/packages/a8/96/2c2755c7048355e3edef36989f88ce8b7775776467d8f95a9e650f472509/rename_clean-1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-15 21:34:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bulletmark",
    "github_project": "rename-clean",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "rename-clean"
}
        
Elapsed time: 1.62189s