LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-29-2009, 02:00 PM   #1
genderbender
Member
 
Registered: Jan 2005
Location: US
Distribution: Centos, Ubuntu, Solaris, Redhat
Posts: 396

Rep: Reputation: 31
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

Last edited by genderbender; 09-29-2009 at 02:02 PM.
 
Old 09-29-2009, 03:50 PM   #2
AngTheo789
Member
 
Registered: Sep 2009
Posts: 110

Rep: Reputation: 24
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/.
 
Old 09-29-2009, 04:24 PM   #3
genderbender
Member
 
Registered: Jan 2005
Location: US
Distribution: Centos, Ubuntu, Solaris, Redhat
Posts: 396

Original Poster
Rep: Reputation: 31
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.

Last edited by genderbender; 09-29-2009 at 04:28 PM.
 
Old 09-29-2009, 08:53 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
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
 
Old 09-30-2009, 11:39 AM   #5
genderbender
Member
 
Registered: Jan 2005
Location: US
Distribution: Centos, Ubuntu, Solaris, Redhat
Posts: 396

Original Poster
Rep: Reputation: 31
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to mass rename files in linux? Please help zardari7 Linux - Newbie 7 07-19-2009 06:27 PM
mass rename files tiaratiara Linux - Newbie 3 02-27-2009 09:49 PM
mass mp3 rename using tr mk6032 Linux - Newbie 2 04-28-2008 07:03 PM
mass rename files cope Programming 4 10-28-2007 12:33 PM
Mass Rename wickdgin Linux - Newbie 2 04-13-2003 03:29 PM


All times are GMT -5. The time now is 10:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration