Skip to content

POWRFULCOW89/batch-rename

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

batch-rename

A CLI tool to help batch renaming of files.

Installation

  1. Get the ZIP or clone the repo:

    gh repo clone POWRFULCOW89/batch-rename
  2. Initialize a virtual environment:

    python -m venv env

    And activate it:

    .\env\Scripts\activate
  3. Install the dependencies:

    (env) pip install -r requirements.txt
  4. Run the tests:

    (env) python test.py
  5. Build from source:

    (env) pyinstaller --onefile main.py

    Or grab the latest release.

  6. (Optional) Add the binary file to PATH.

Usage

  1. Help flag:

    batch-rename -h

    Outputs:

    usage: batch-rename.exe [-h] [-n] [path] substring [new_string]
    
    Batch rename files, stripping a given substring
    
    positional arguments:
      path        Path to directory with files to rename. Defaults to current working directory.
      substring   Substring to strip or replace out of every file in path.
      new_string  String to replace for every matching substring. Defaults to an empty string.
    
    optional arguments:
      -h, --help  show this help message and exit
      -n          Rename all files to substring and number them accordingly.
  2. Strip all ocurrences of "log" in the current directory:

    batch-rename log
  3. Strip all ocurrences of "python" in an absolute path:

    batch-rename "C:/Users/<you>/Documents/PDF" python
  4. Rename all files in the "Songs" subdirectory numerically with a starting string:

    batch-rename Music/Songs "Track - " -n
  5. Replace all ocurrences of "log" with "report" in the current directory:

    batch-rename ./ log report

TO-DO

  • RegEx support

About

CLI tool to help the batch renaming of files.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages