Skip to main content

A batch renaming script to remove substrings from filenames and directories.

Project description

# Butch Filename Substring Remover

This is a batch renaming script to remove substrings from filenames and directories.

## Installation

You can install this package using pip:

```bash
pip install butch_filename_substring_remover

Usage

Command Line

butch-rename /path/to/directory substring1 substring2

As a Module

from butch_filename_substring_remover import rename_directory

root_directory = '/path/to/directory'
substrings_to_remove = ['substring1', 'substring2']

try:
    rename_directory(root_directory, substrings_to_remove)
    print("Renaming completed successfully.")
except Exception as e:
    print(f"An error occurred: {e}")

Example

Assume you have a directory with the following files:

/example_dir
    file1_test.txt
    file2_sample.txt
    subdir1_test

Running the following command:

butch-rename /example_dir test sample

will rename the files to:

/example_dir
    file1_.txt
    file2_.txt
    subdir1_

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

butch_filename_substring_remover-0.1.3.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file butch_filename_substring_remover-0.1.3.tar.gz.

File metadata

File hashes

Hashes for butch_filename_substring_remover-0.1.3.tar.gz
Algorithm Hash digest
SHA256 cd8c1b0ca6f03e26bada80cb72e78ecdf01cf29d87f41418588f356294dc1522
MD5 0c09e1f035a12e06540f0f67c7c455c1
BLAKE2b-256 77450a23905f3b398e396f2bb3d6f78a5a12d4a19b21df0fec08814bbc66a046

See more details on using hashes here.

File details

Details for the file butch_filename_substring_remover-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for butch_filename_substring_remover-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 deba8383883c8f20db3ebbef6109bfa7fe18a81de65af0201937a5ef0cbb8985
MD5 0d7866a7715188437a114b9a5e5e6f98
BLAKE2b-256 549447cd0c15b20eb6990cc7d25e2114fb73fc9741e25b25a7a20bf86361e226

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page