Skip to content

isalevine/file-renamer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

File Renamer

A Python CLI for renaming single and multiple files. Designed to format sample filenames for drum machines, but you can use it for whatever kind of files you want! :)

gif of file-renamer in action, showing file names as they change

NOTE: Default directory is currently set to a .gitignore-ed folder of drum samples. Make sure to update this in order to avoid errors!

Read more about the project in this article on Dev.to!

Highlights

1. This is the first Python code I've ever written!

The initial code to navigate the filesystem and rename individual files was written over a two-day period, which included learning Python from scratch.

I was especially excited to dive into using the pathlib and os Python modules, as well as get hands-on learning with the basics of Python's iterations, variable scoping, and string-manipulation tools like rpartition!

2. The functionality is designed specifically for renaming audio sample files for music producers.

This is a small project as part of my passion for music production. I created this specifically to help rename large numbers of long, repetitive drum sample filenames.

I use it regularly to format filenames to display properly on my MPC 2500!

3. Command-line controls mimic Unix console commands!

ls, cd, and pwd are all used as commands to navigate the filesystem.

The primary renaming functionality is rn and rn all.

There's also a WIP help menu that will be accessible via h or help!

Requirements

  • Python3 version 3.7.5 or higher

Setup

  1. Clone this repo.
  2. Update the default directory. This is where the CLI will start in your filesystem. I recommend setting it to a common audio sample directory.
  3. Open by running python3 script.py in the main directory.

Use

Open by running python3 script.py in the main directory.

Use cd commands to navigate to the files you want to rename. File Renamer can target individual files, or can do (currently) basic string matching to change multiple filenames in the same directory.

Example:

INPUT:
Yamaha_DTX-MULTI Kick 01.wav
Yamaha_DTX-MULTI Kick 02.wav
Yamaha_DTX-MULTI Kick 03.wav
Yamaha_DTX-MULTI Snare 01.wav
$ rn all Yamaha_DTX-MULTI Dtx
OUTPUT:
Dtx Kick 01.wav
Dtx Kick 02.wav
Dtx Kick 03.wav
Dtx Snare 01.wav

Final confirmation (Y/n) will be requested for all multi-file rename commands.

NOTE: Spaces are not currently handled. Instead, make 1-by-1 changes to individual space-separated words.

Commands

Change Directory:

cd

List Files:

ls

Print Directory:

pwd

Rename (single file, change entire filename):

rn <current_filename.ext> <new_filename.ext>

$ rn Airhorn.wav AIRHOOOORN.wav

Rename All (multiple files, replace LAST string match found in each filename):

rn all <string_input> <string_output>

$ rn all Hihat HH

Note: Currently, using backslashes \ to represent spaces in filenames is NOT working!

Note: Currently, rn all will replace ALL matching instances of <string_input> encountered in the filename, NOT just the first match encountered.

Exit Program:

q / quit

Notes

Upcoming plans:

Credits

Special thanks to https://samplesfrommars.com/ for the incredible samples in use on my MPC. <3

About

Python CLI for renaming single and multiple files, designed for managing audio sample libraries!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages