How to Bulk Rename Files

PYPI package as a command line interface tool (CLI tool) Bulkren

​So, most of the time we encounter a situation for renaming the files in large quantity, persons who create datasets to the persons who just want to organise a folder with some conventional names. To make this hectic task more convinent. I have created my own PYPI package as a command line interface tool (CLI tool) Bulkren which i think can help you out in reducing the work required from going file to file and renaming them by hand to just writting a single command on command prompt (cmd).

Installing Bulkren

So, to use this package, we first need to install in on our machine and to install it on your machine you firstly need python installed on your machine and then you must have pip installed on it. If you already satisfy this requirement then you are ready to go ahead and follow up the tutorial but if not i would recommend to checkout the resources on How to install Python and the How to install pip in Python and don't forget to add python to PATH in Environments on your machine.

Now to get started with renaming bunch of files in a single go, first we run the following command to download the Bulkren package.

pip install Bulkren

Renaming Files Using Bulkren

And now to rename files, ensure that all files are inside a folder, we will call it a Input Folder and right the following command.

python -m Bulkren -i "input_folder_path" -o "output_folder_path" -p "patter_to_rename"

Now here,
-i or --input takes input folder path
-o or --output takes output folder path
-p or --pattern takes pattern for renaming files.

Example

Let's try to understand it with a example,

python -m Bulkren -i C:\User\Akash\Desktop\input_folder -o C:\User\Akash\Desktop\output_folder -p images_XYZ

This above example will take all the files in C:\User\Akash\Desktop\input_folder and then rename it with pattern images_XYZ where XYZ would be replaced number count of file (remember to add XYZ in end only) and will save it to the C:\User\Akash\Desktop\output_folder folder.

Note : If the -o argument is not passed then it will automatically create a output named folder in same parent directory, for above example the output folder path would be C:\User\Akash\Desktop\output

So, i hope now you might have got how to use Bulkren and how you can use it to save your time in doing such a hectic task.

Thank you!

Akash Srivastava
Software Engineer @ Seawoods Ventures Inc.
© 2019-2024 dev-akash.in