
, a new_path string is created from current_directory.parent, and is turned back into a Path object with current_directory = pathlib.Path(new_path). isdir ( current_directory ): print ( "Not a valid directory!" ) current_directory = temp_directory join ( current_directory, user_input ) current_directory = pathlib. If user_input = "cd" : temp_directory = current_directory if user_input = "." : new_path = current_directory. # inside main loop, after getting user_input realpath ( './drum-samples' ) # set default path hereĬurrent_directory = pathlib. See script.py line 37 (as of this writing) for the code to change: The only configuration you will need to do is setting a default path.

As a CLI, file-renamer also provides a way to navigate a filesystem to modify files in different folders quickly and easily from the command line.Īfter cloning the repo to your computer, you can run file-renamer with $ python3 script.py in the repo's directory. I got really tired of renaming them one-by-one, so I wrote my first Python script, file-renamer, as a CLI to do mass-renaming!īasically, I wanted a way to change or remove specific strings from multiple filenames at once. One drawback of the my main drum machine is that it limits readable filenames-anything after a certain number of characters is cut off, and any name-collisions will point to the first file with that name.Ī lot of my music sample library has folders full of long, repetitive filenames, like this: One of my hobbies is making electronic music, and thanks to resources like, I have tons and tons of audio files to manage.
