LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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, 01: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 01:02 PM.
 
Old 09-29-2009, 02: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, 03: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 03:28 PM.
 
Old 09-29-2009, 07:53 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,358

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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, 10: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



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 05:27 PM
mass rename files tiaratiara Linux - Newbie 3 02-27-2009 08:49 PM
mass mp3 rename using tr mk6032 Linux - Newbie 2 04-28-2008 06:03 PM
mass rename files cope Programming 4 10-28-2007 11:33 AM
Mass Rename wickdgin Linux - Newbie 2 04-13-2003 02:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:38 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
Open Source Consulting | Domain Registration