jueves, 20 de enero de 2011

Change Extension to a Group of Files in The Linux's Console

Hello, cyber-surfers!

How many times have we faced the problem where we have to change the file extension to a lot of files? ...Will we do it by hand? No way!!! This is the why machines exist!!!

Well, here you are a simple solution: Its name is rename. Hey! It is not a joke! This is a Linux's command which allows us, as its name, rename to a group of files by using Perl's RegEx.

Now, e.g. related with the last post, where I talked to you about how to  get audio from the Google's magic servers, this is a great tool, because the Google's servers' audio come in .mpga file extension, but the common mobile devices support the .mp3 file extension for audio. How can we solve this problem? By using the following command:

rename 's/\.mpga/\.mp3/' *.mpga

...to convert from .mpga to .mp3 audio file extension, as it is proposed here.

See you soon! ;-)

3 comentarios:

Ramiro dijo...

Buen comando, no lo conocía. El regex es realmente poderoso, y me ha ahorrado mucho trabajo.

Aunque para el ejemplo que diste yo hubiera usado un mv :P.

Trailers Videos dijo...

Gracias por tu aporte

Byte77 dijo...

Un placer servirles ;-)