algorename


Namealgorename JSON
Version 1.6 PyPI version JSON
download
home_page
SummaryA utility to change file names based on algorithms.
upload_time2023-09-06 17:19:31
maintainer
docs_urlNone
authorMario Nascimento
requires_python
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # AlgoRename

[![Build Status](https://img.shields.io/badge/build-passing-green)]()
[![GitHub release](https://img.shields.io/github/release/darkarp/algorename.svg)](https://github.com/darkarp/algorename/releases/)
[![License](https://img.shields.io/github/license/darkarp/algorename.svg)](https://github.com/darkarp/algorename/blob/main/LICENSE)


## Table of Contents

- [Introduction](#introduction)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Usage](#usage)
  - [Command Line Arguments](#command-line-arguments)
- [Algorithm Loading](#algorithm-loading)
- [Algorithm Listing](#algorithm-listing)
- [Multiprocessing](#multiprocessing)
- [Logging](#logging)
- [License](#license)


## Introduction

This utility is a Python script designed to rename files in a folder or an individual file based on a dynamically loaded algorithm. It utilizes multiprocessing for efficiency and can operate recursively on directories. The example algorithm shifts each alphabetic character in the filenames to the left by 1.

## Prerequisites

- Python 3.6+


## Installation

1. Clone the GitHub repository.
   ```
   git clone https://github.com/darkarp/algorename.git
   ```
2. Navigate to the project directory.
   ```
   cd algorename
   ```
3. Install the required Python packages.
   ```
   pip install -r requirements.txt
   ```

## Usage

### Command Line Arguments

1. To rename a single file:
 ```
 python algorename.py -f [path/to/your/file]
 ```

2. To rename all files in a directory:
 ```
 python algorename.py -d [path/to/your/directory]
 ```

3. To rename files recursively in a directory:
 ```
 python algorename.py -d [path/to/your/directory] -r
 ```

4. For silent mode (suppress errors):
 ```
 python algorename.py -s (...)
 ```  

5. To not create a log file:
 ```
 python algorename.py -nl (...)
 ```  

6. To use a specific algorithm:
 ```
 python algorename.py -a [algorithm_name]
 ```  

7. To list available algorithms:
 ```
 python algorename.py -l
 ```

8. For help:
 ```
 python algorename.py -h
 ```

## Algorithm Loading  

The script supports loading custom algorithms. Place your algorithm module under the `algorithms/` folder, and the script will be able to import it dynamically. Make sure to define a function called `apply_algorithm` within the module.

The environment variable `FCLOG_PATH` specifies the directories where the script will look for custom algorithm modules. You can modify this by changing your environment variables or by creating a `.env` file.

Example:  

- Windows: `FCLOG_PATH=C:\path\to\algorithms;D:\another\path\to\algorithms`
- Linux/Mac: `FCLOG_PATH=/path/to/algorithms:/another/path/to/algorithms`

## Algorithm Listing  

You can list all available algorithms along with their metadata using the `-l` flag. This is useful for understanding what each algorithm does before using it.

## Multiprocessing

This utility uses multithreading to efficiently rename multiple files in a directory. It uses `concurrent.futures.ThreadPoolExecutor` to speed up the renaming tasks.

## Logging

Logging is implemented with a rotating log file mechanism to ensure that it doesn't consume too much disk space over time. The log file will be generated in the same directory as the script, named `algorename.log`. 

- You can set the logging verbosity level via an environment variable `FCLOG_LEVEL`, which accepts values like `DEBUG`, `INFO`, `WARNING`, `ERROR`, and `CRITICAL`.
- You can set the log file name via an environment variable `FCLOG_NAME`. This name will be converted to lower-case.
- You can disable logging by specifying `-nl` argument.

## License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE) file for details.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "algorename",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Mario Nascimento",
    "author_email": "mario@whitehathacking.tech",
    "download_url": "https://files.pythonhosted.org/packages/4c/ca/adac426bedcfa0218152b85f8ca98cc913eeb6ff24d05c4746ff1b67c202/algorename-1.6.tar.gz",
    "platform": null,
    "description": "# AlgoRename\r\n\r\n[![Build Status](https://img.shields.io/badge/build-passing-green)]()\r\n[![GitHub release](https://img.shields.io/github/release/darkarp/algorename.svg)](https://github.com/darkarp/algorename/releases/)\r\n[![License](https://img.shields.io/github/license/darkarp/algorename.svg)](https://github.com/darkarp/algorename/blob/main/LICENSE)\r\n\r\n\r\n## Table of Contents\r\n\r\n- [Introduction](#introduction)\r\n- [Prerequisites](#prerequisites)\r\n- [Installation](#installation)\r\n- [Usage](#usage)\r\n  - [Command Line Arguments](#command-line-arguments)\r\n- [Algorithm Loading](#algorithm-loading)\r\n- [Algorithm Listing](#algorithm-listing)\r\n- [Multiprocessing](#multiprocessing)\r\n- [Logging](#logging)\r\n- [License](#license)\r\n\r\n\r\n## Introduction\r\n\r\nThis utility is a Python script designed to rename files in a folder or an individual file based on a dynamically loaded algorithm. It utilizes multiprocessing for efficiency and can operate recursively on directories. The example algorithm shifts each alphabetic character in the filenames to the left by 1.\r\n\r\n## Prerequisites\r\n\r\n- Python 3.6+\r\n\r\n\r\n## Installation\r\n\r\n1. Clone the GitHub repository.\r\n   ```\r\n   git clone https://github.com/darkarp/algorename.git\r\n   ```\r\n2. Navigate to the project directory.\r\n   ```\r\n   cd algorename\r\n   ```\r\n3. Install the required Python packages.\r\n   ```\r\n   pip install -r requirements.txt\r\n   ```\r\n\r\n## Usage\r\n\r\n### Command Line Arguments\r\n\r\n1. To rename a single file:\r\n ```\r\n python algorename.py -f [path/to/your/file]\r\n ```\r\n\r\n2. To rename all files in a directory:\r\n ```\r\n python algorename.py -d [path/to/your/directory]\r\n ```\r\n\r\n3. To rename files recursively in a directory:\r\n ```\r\n python algorename.py -d [path/to/your/directory] -r\r\n ```\r\n\r\n4. For silent mode (suppress errors):\r\n ```\r\n python algorename.py -s (...)\r\n ```  \r\n\r\n5. To not create a log file:\r\n ```\r\n python algorename.py -nl (...)\r\n ```  \r\n\r\n6. To use a specific algorithm:\r\n ```\r\n python algorename.py -a [algorithm_name]\r\n ```  \r\n\r\n7. To list available algorithms:\r\n ```\r\n python algorename.py -l\r\n ```\r\n\r\n8. For help:\r\n ```\r\n python algorename.py -h\r\n ```\r\n\r\n## Algorithm Loading  \r\n\r\nThe script supports loading custom algorithms. Place your algorithm module under the `algorithms/` folder, and the script will be able to import it dynamically. Make sure to define a function called `apply_algorithm` within the module.\r\n\r\nThe environment variable `FCLOG_PATH` specifies the directories where the script will look for custom algorithm modules. You can modify this by changing your environment variables or by creating a `.env` file.\r\n\r\nExample:  \r\n\r\n- Windows: `FCLOG_PATH=C:\\path\\to\\algorithms;D:\\another\\path\\to\\algorithms`\r\n- Linux/Mac: `FCLOG_PATH=/path/to/algorithms:/another/path/to/algorithms`\r\n\r\n## Algorithm Listing  \r\n\r\nYou can list all available algorithms along with their metadata using the `-l` flag. This is useful for understanding what each algorithm does before using it.\r\n\r\n## Multiprocessing\r\n\r\nThis utility uses multithreading to efficiently rename multiple files in a directory. It uses `concurrent.futures.ThreadPoolExecutor` to speed up the renaming tasks.\r\n\r\n## Logging\r\n\r\nLogging is implemented with a rotating log file mechanism to ensure that it doesn't consume too much disk space over time. The log file will be generated in the same directory as the script, named `algorename.log`. \r\n\r\n- You can set the logging verbosity level via an environment variable `FCLOG_LEVEL`, which accepts values like `DEBUG`, `INFO`, `WARNING`, `ERROR`, and `CRITICAL`.\r\n- You can set the log file name via an environment variable `FCLOG_NAME`. This name will be converted to lower-case.\r\n- You can disable logging by specifying `-nl` argument.\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE) file for details.\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A utility to change file names based on algorithms.",
    "version": "1.6",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2d000c2a36bac2e2367e1682c0aa1533a243d6f2bae315eb0fb5c246a9329291",
                "md5": "bd0b33dd3f657dd5e691c83ed30f0b7f",
                "sha256": "0e596e915823e23efdcc64a52ce47cd14fe75428ed81c4642b7057defbf2a0ea"
            },
            "downloads": -1,
            "filename": "algorename-1.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bd0b33dd3f657dd5e691c83ed30f0b7f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 9067,
            "upload_time": "2023-09-06T17:19:30",
            "upload_time_iso_8601": "2023-09-06T17:19:30.128784Z",
            "url": "https://files.pythonhosted.org/packages/2d/00/0c2a36bac2e2367e1682c0aa1533a243d6f2bae315eb0fb5c246a9329291/algorename-1.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4ccaadac426bedcfa0218152b85f8ca98cc913eeb6ff24d05c4746ff1b67c202",
                "md5": "d112326e3bd591c252a945b432e86825",
                "sha256": "2ea29a501f1d84accfd37be9e63faaf6aa2094e4ab6559d65983dc720f77ae8a"
            },
            "downloads": -1,
            "filename": "algorename-1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "d112326e3bd591c252a945b432e86825",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7926,
            "upload_time": "2023-09-06T17:19:31",
            "upload_time_iso_8601": "2023-09-06T17:19:31.898347Z",
            "url": "https://files.pythonhosted.org/packages/4c/ca/adac426bedcfa0218152b85f8ca98cc913eeb6ff24d05c4746ff1b67c202/algorename-1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-06 17:19:31",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "algorename"
}
        
Elapsed time: 1.31663s