Yes, I know
How to change the extension of many files at once

My wife wanted to create a photo-book using a popular web site. Unfortunatelly, the .JPE files produced by our camera were rejected. We had to change their extension to .JPG for the web site to process them. Annoying waste of time ? Not that much if you know the prename command !

 Get the support materialCheck your mailbox for the link!  View on YouTube 

Share 
How to change the extension of many files at once

Update

Debian Strech (2016) deprecated the use of prename in favor of rename. This is the exact same command but with a different name.

The prename name was choosen to distinguish between the rename Perl script and the Linux Kernel utility of the same name. That later is now known as rename.ul.

Confusing ? Still not sure which version of rename is already installed on your computer ? As a simple trick, if in the very first line of the man rename page you see "Perl", this is the command described in this video. Otherwise, you probably have the Linux Kernel rename utility (which of course uses a totally different syntax ;)

How can I take the most of this video?

I encourage you to download the files used on the video so you will be able to try the same commands as me on your own system.

What if prename is not available on my system?

First, use your package manager to check if prename is available in your distribution. Some distributions have a dedicated prename package. Others install it as part of the Perl package.

  • Perl is required to use prename as that later is a few line Perl script (i.e.: a program written in the Perl language).

  • To install prename using the precedure bellow, you need to have access to the sudo command. It is very probably already installed on your system. Once again, if it is not, install it using your package manager.

    1. If really you can’t find the prename ` script for your distribution, download it from my gist account and save it as prename into your home directory. In my case, this is `/home/yesik.

    2. Open your terminal and type the following commands : ` cd chmod +x prename sudo cp prename /usr/local/bin `

    3. Check you installation using the which command : ` which prename || echo Missing # ^-- if this will display /usr/local/bin/prename then is all went well # if not, try to verify you didn’t miss any step or just contact me. `

What is the target audience?

This video is clearly aimed toward new shell users. The video was designed on a Linux system and using the Bash shell. But the features demonstrated here are generic enough to work with other shells and/or other Unix-like OS (*BSD, MacOSX, …​).

What are the requirements?

  • You should have a working Unix-like system.

  • You should be confortable with your file manager/file explorer.

  • Perl should be installed on your system.