LinuxQuestions.org
Visit Jeremy's Blog.
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 03-26-2004, 10:57 AM   #1
HawkeyeCoug
LQ Newbie
 
Registered: Mar 2004
Location: Tucson, AZ
Distribution: Mandrake 9.1
Posts: 20

Rep: Reputation: 0
Solution: renaming multiple files with spaces


I have been struggling to figure out how to rename multiple music files. I usually like to name my music files in a "artist~CD~track~title" or "CD~track~artist~title" format. However, sometimes I don't like the way the naming came out, and want to change the artist or CD name. I know I can do it by using the mouse and renaming that way, but it gets tiring, especially when I know there is some way to do it from the command line.

Part of my problem with the command line was dealing with the spaces in my files. I prefer to have spaces because it really does make it much easier to read, as opposed to using the underscore. Anyway, I kept running into problems using the "mv" command to try and rename them. Finally, I lighted upon the rename command, and after a few more trials and errors, got it to work. Here is the command I gave it. Hopefully it will save you some time.

First, I wanted to insert a "Volume 1" designation into the title of a CD that didn't have one.

So, I gave the command: rename "The Best of Tchaikovsky" "The Best of Tchaikovsky V1" The*

The quotes keep the file name together. This then replaces each instance of "The Best of Tchaikovsky" with the same thing plus a V1. No wildcards necessary, as it finds the matches automatically. In fact, it messes it up if you stick a wildcard on the end. The final argument, The*, chooses every file in the directory starting with "The" to make the change to.

I hope this helps you keep your music or other types of files with long names and spaces in line. I think the rename works much better than mv for these, as I havn't got mv to work like this. Although I am sure that someone with more knowledge than me knows many ways of doing this.
 
  


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
renaming multiple files linuxhippy Slackware 10 01-21-2011 01:53 AM
renaming multiple files in general kkatebian Linux - General 5 11-06-2005 11:05 AM
Renaming Multiple Files with a "." on the end of the filename dbowles Programming 1 05-09-2005 04:28 PM
Need help with shell script - renaming multiple files NiallC Linux - Newbie 25 07-04-2004 10:45 AM
Renaming multiple files with the same format Shr00mBoXx Slackware 7 06-20-2004 07:22 PM

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

All times are GMT -5. The time now is 07:28 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