Clean Up File Names Via Python

python_rename_CK
Standard

Today I would like to share a tiny script that I use to tidy my folders. As an example, I am generally not interested in the year the film was made e.g. BladeRunner(1982) and prefer it listed as BladeRunner in my films directory. This script will do just that, modify the file names of files, without changing the internal contents. Here is an example of the script in action:

python_rename_CK That definitely looks better, to me at least. Here’s a run-down of what just happened and how:

  1. ls – displays the basic (non-hidden) contents of a folder
  2. python rename_CK.py && ls – This runs the python script on the folder it is placed in. For me, it was my working folder i.e. ~/Documents/…/brackets_backup then it uses && to run multiple command on line line, followed by ls to view the results
  3. Results displayed

The python script can be found here: https://github.com/C-Kenny/batch_file_renamer_python


Future Plans:

  • Add a recursive modifier, so that it is able to go inside various sub-folders and continue the good work
  • Rewrite in C for fun
  • Make good use of the script via ssh
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s