LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Mass mv/rename (https://www.linuxquestions.org/questions/linux-newbie-8/mass-mv-rename-758487/)

genderbender 09-29-2009 01:00 PM

Mass mv/rename
 
Hi, I've just purchased a network based hard drive and have begun copying my media onto it. I've got a few hundred "badly named" TV shows, could someone help me rename the episodes?

Files are named as follows (with an example):

Code:

tvshowname - seasonXepisode - episodename
Lost - 4x02 - Still Lost On An Island.avi

I would like them named as follows:

Code:

tvshowname - episode - episodename
Lost - 02 - Still Lost On An Island.avi

This is obviously going to be a script or a complicated one liner' but as it's a basic command (mv right?) I thought I'd pass this to the newbie section.

Thanks guys :D

AngTheo789 09-29-2009 02:50 PM

rename is a CLI tool for renaming files - install it and read the man page for details.
The rename command is part of the util-linux-ng package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/.

genderbender 09-29-2009 03:24 PM

Rename and mv work in exact are the same, the only difference is rename is perl based and mv is pure C.

If you look on the mv man page, it specified numerous times that it can be used to rename files.

chrism01 09-29-2009 07:53 PM

The main diff between mv, mmv (yes really) & rename is in the use of wildcards/patterns:

http://linux.die.net/man/1/rename
http://linux.die.net/man/1/mv
http://linux.die.net/man/1/mmv

genderbender 09-30-2009 10:39 AM

mmv, that sounds interesting. I ended up mounting the drive as a network volume and doing it through the gui in the end. There were similar scripts about but didn't want to take the risk and have thousands of folders named wrong.

Thanks anyway guys.


All times are GMT -5. The time now is 01:37 AM.