Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 01-15-2012, 12:16 AM   #1
Registered: Jan 2010
Distribution: Ubuntu
Posts: 97

Rep: Reputation: 4
Smile Renaming files in mass

Hello all,

I recently downloaded a few .mp3 files from a website. They are all named non-descriptive names and I want to change them all at once. I KNOW that I can do this if I could some how make two arrays array1 = old names and array2 = new names. Then issue the mv command with something like:
mv array1 array2
I have a text file containing the new names and I can already make the names within the text file into an array. I just cannot think of what I need to do to place the .mp3 file names into an array and then to make the script one for one rename all the files to the new names.

I almost forgot, the file named almost.txt is my script. The other file is self explanatory...
Attached Files
File Type: txt almost.txt (993 Bytes, 17 views)
File Type: txt old_and_new_file_names.txt (7.8 KB, 22 views)

Last edited by lonesoac0; 01-15-2012 at 12:18 AM. Reason: more info
Old 01-15-2012, 12:30 AM   #2
Senior Member
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
You don't need arrays at all. Try this:


while read old_filename new_filename ; do
  echo "mv \"${old_filename}\" \"${new_filename}.mp3\""
  # mv "${old_filename}" "${new_filename}.mp3"
done < old_and_new_file_names.txt
Save it, make it executable, and run it from the same directory that has old_and_new_file_names.txt (and the mp3s of course).

It will display the commands it will execute. If they look ok, then remove the '#' from the line with the actual mv command (in red).

As with any script/command that will move/delete files, I suggest running it on a small portion to test before letting it loose on your whole data set.

I should make mention: the while-read command assumes that the old_filename in the data file does not include a space. From what I saw in your data file, that was not the case. Be that as it may, I felt I should point that out.

Removed the sed command (not necessary), and moved the input file to the "end" of the while loop.

Last edited by Dark_Helmet; 01-15-2012 at 12:41 AM.
1 members found this post helpful.
Old 01-15-2012, 02:55 AM   #3
David the H.
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian + kde 4 / 5
Posts: 6,837

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Not to sound rude, but it's generally a good idea to run a search on your topic before posting, so you can read some of the hundreds of other threads that have already been posted on the bulk renaming of files. (If you have done this, please accept my apologies in advance.)

One option you might be interested in is qmv, part of the renameutils package. It opens up a list of filenames in the text editor of your choice, lets you modify them, then renames the files when you exit.

But to answer your exact query, to use arrays, you must load the two arrays so that they have matching index numbers. Then you loop through those index numbers one-by-one, renaming each in turn. Here's one way to do it, with a safer technique for parsing the values than Dark Helmet's.

shopt -s extglob # We need extended globbing in order to parse the variable no. of spaces between the two fields.

while read line; do
	array1+=( "${line%%.mp3*}.mp3" )
	array2+=( "${line##*mp3+( )}.mp3" )
done <file

for i in "${!array1[@]}"; do
	mv "${array1[i]}" "${array2[i]}"
	#mv "${array1[i]}" "${array2[i]// /_}"	#use this one to replace spaces with underscores at the same time.
Read parameter substitution, exended globbing, and using arrays to understand the above.

As DH showed though, it's not actually necessary to use arrays here. I included them above mostly in order to demonstrate the technique.

Last edited by David the H.; 01-15-2012 at 03:04 AM. Reason: fixed links
Old 01-15-2012, 07:22 AM   #4
Registered: Oct 2010
Location: Bengaluru, India
Distribution: RHEL 5.1 on My PC, & SunOS / Sun Solaris, RHEL, SuSe, Debian, FreeBSD and other Linux flavors @ Work
Posts: 593

Rep: Reputation: 59
The first answer is compact enough.

You should do a listing of original file names:

ls -1
and then redirect it to a file:

ls -1 > list
Edit this file and add new names.

Well, I just noticed your sample files. The one that contain the files names is okay enough to go:

[demo@localhost Bash]$ while read old_name new_name; do echo "mv $old_name '$new_name'"; done < songs.txt 
mv chinesepod_A0001pb.mp3 'Good Morning'
mv chinesepod_A0002pb.mp3 'Whats Your Name'
mv chinesepod_A0003pb.mp3 'Where Are You From'
mv chinesepod_A0004pb.mp3 'Do You Like China'
mv chinesepod_A0005pb.mp3 'Do You Have A Menu'
mv chinesepod_A0006pb.mp3 'I Want To Buy This One'
mv chinesepod_A0024pb.mp3 'Colors'
mv chinesepod_A0031pb.mp3 'All In The Family'
mv chinesepod_A0033pb.mp3 'Paying The Bill'
mv chinesepod_A0037pb.mp3 'Dialect Party Mix'
mv chinesepod_A0044pb.mp3 'Friends For Dinner'
mv chinesepod_A0045pb.mp3 'Long Time No See'
mv chinesepod_A0048pb.mp3 'A Correction Of Tones'
mv chinesepod_A0051pb.mp3 'How You Doin'
mv chinesepod_A0052pb.mp3 'What Are Your Hobbies'
mv chinesepod_A0053pb.mp3 'Taxi Conversations Destination'
mv chinesepod_A0058pb.mp3 'Too Many Cooks'
mv chinesepod_A0061pb.mp3 'Describing The Weather'
mv chinesepod_A0062pb.mp3 'Taxi Conversations Suggesting A Route'
mv chinesepod_A0064pb.mp3 'Lying In Chinese'
mv chinesepod_A0065pb.mp3 'Taxi Conversations Arriving At Your Destinatiion'
mv chinesepod_A0067pb.mp3 'Hotel Motel Holiday Inn'
mv chinesepod_A0071pb.mp3 'Useful Phrases1'
mv chinesepod_A0073pb.mp3 'New Year'
mv chinesepod_A0077pb.mp3 'Explaining Your Occupation'
mv chinesepod_A0080pb.mp3 'Useful Phrases2'
mv chinesepod_A0083pb.mp3 'Im Not Hungry'
mv chinesepod_A0088pb.mp3 'Marriage And Divorce'
mv chinesepod_A0090pb.mp3 'University Major Part1'
mv chinesepod_A0092pb.mp3 'Surfing The Internet'
mv chinesepod_A0094pb.mp3 'Sending Emails'
mv chinesepod_A0095pb.mp3 'Addresses'
mv chinesepod_A0097pb.mp3 'Invitations To Eat'
mv chinesepod_A0099pb.mp3 'Asking For Favors'
mv chinesepod_A0103pb.mp3 'Buying Train Tickets'
mv chinesepod_A0108pb.mp3 'Baby Talk Words Of Comfort'
mv chinesepod_A0109pb.mp3 'Singing Ability'
mv chinesepod_A0110pb.mp3 'University Major Part2'
mv chinesepod_A0113pb.mp3 'Talking About Your Hometown'
mv chinesepod_A0117pb.mp3 'You Look Nervous'
mv chinesepod_A0119pb.mp3 'Chatting Online'
mv chinesepod_A0121pb.mp3 'Drive Faster'
mv chinesepod_A0122pb.mp3 'What Time Is It'
mv chinesepod_A0124pb.mp3 'Too Polite'
mv chinesepod_A0126pb.mp3 'Baby Talk Be Good'
mv chinesepod_A0128pb.mp3 'Your Receipt'
mv chinesepod_A0130pb.mp3 'I Dont Feel Well'
mv chinesepod_A0133pb.mp3 'Downloading Music'
mv chinesepod_A0134pb.mp3 'Youre Late Again'
mv chinesepod_A0136pb.mp3 'Its Broken'
mv chinesepod_A0138pb.mp3 'Definitely'
mv chinesepod_A0140pb.mp3 'Baby Talk Praise'
mv chinesepod_A0142pb.mp3 'How Are You'
mv chinesepod_A0145pb.mp3 'Baby Talk Eat Up'
mv chinesepod_A0147pb.mp3 'I Miss You'
mv chinesepod_A0150pb.mp3 'Whats His Name'
mv chinesepod_A0152pb.mp3 'She Went Out'
mv chinesepod_A0155pb.mp3 'I Like Beef'
mv chinesepod_A0159pb.mp3 'World Cup Football Terms'
mv chinesepod_A0163pb.mp3 'Wheres The Bathroom'
mv chinesepod_A0165pb.mp3 'Allergies'
mv chinesepod_A0168pb.mp3 'Finding A Seat'
mv chinesepod_A0172pb.mp3 'Exchanging Money'
mv chinesepod_A0175pb.mp3 'Vegetarian Eating'
mv chinesepod_A0180pb.mp3 'May I Take Your Photo'
mv chinesepod_A0184pb.mp3 'Finding A Cheap Hostel'
mv chinesepod_A0186pb.mp3 'Transportation'
mv chinesepod_A0191pb.mp3 'Using A Credit Card'
mv chinesepod_A0196pb.mp3 'How Do You Say'
mv chinesepod_A0200pb.mp3 'Im Here For An Interview'
mv chinesepod_A0205pb.mp3 'What Is This Called'
mv chinesepod_A0209pb.mp3 'Too Expensive'
mv chinesepod_A0213pb.mp3 'No Thank You'
mv chinesepod_A0218pb.mp3 'Little Friends'
mv chinesepod_A0221pb.mp3 'I Love China'
mv chinesepod_A0226pb.mp3 'Lost Luggage'
mv chinesepod_A0229pb.mp3 'Stomach Trouble'
mv chinesepod_A0235pb.mp3 'Mailing A Letter'
mv chinesepod_A0239pb.mp3 'What Character'
mv chinesepod_A0242pb.mp3 'Hotel Essentials'
mv chinesepod_A0247pb.mp3 'The Olympics'
mv chinesepod_A0253pb.mp3 'Baby Talk Friends Song'
mv chinesepod_A0257pb.mp3 'Im Hungry'
mv chinesepod_A0263pb.mp3 'Ouch'
mv chinesepod_A0268pb.mp3 'Wheres The Garbage'
mv chinesepod_A0272pb.mp3 'Business Cards'
mv chinesepod_A0277pb.mp3 'Black Or Green Tea'
mv chinesepod_A0281pb.mp3 'Feminine Products'
mv chinesepod_A0286pb.mp3 'Im Cold'
mv chinesepod_A0290pb.mp3 'Stopping The Taxi'
mv chinesepod_A0296pb.mp3 'Asking For Change'
mv chinesepod_A0301pb.mp3 'The Door'
mv chinesepod_A0304pb.mp3 'Playing Cards'
mv chinesepod_A0308pb.mp3 'A Late Knock'
mv chinesepod_A0311pb.mp3 'A Startled Friend'
mv chinesepod_A0316pb.mp3 'Thirsty For Water'
mv chinesepod_A0323pb.mp3 'Stand Up'
mv chinesepod_A0329pb.mp3 'This Is Mine'
mv chinesepod_A0333pb.mp3 'Happy Birthday'
mv chinesepod_A0338pb.mp3 'Please Speak Slowly'
mv chinesepod_A0343pb.mp3 'Im Not Chinese'
mv chinesepod_A0346pb.mp3 'At The Zoo'
mv chinesepod_A0351pb.mp3 'Being Seated In A Restaurant'
mv chinesepod_A0354pb.mp3 'Feeling Nauseous'
mv chinesepod_A0358pb.mp3 'Im Really Full'
mv chinesepod_A0361pb.mp3 'Asking For Help'
mv chinesepod_A0365pb.mp3 'I Got Married'
mv chinesepod_A0368pb.mp3 'I Cant Sing'
mv chinesepod_A0372pb.mp3 'What Are You Doing'
mv chinesepod_A0376pb.mp3 'Asking The Bus Destination'
mv chinesepod_A0381pb.mp3 'Simple Toasts'
mv chinesepod_A0383pb.mp3 'Noodles Without Cilantro'
mv chinesepod_A0386pb.mp3 'so There'
mv chinesepod_A0389pb.mp3 'Have You Eaten'
mv chinesepod_A0393pb.mp3 'Going On Vacation'
mv chinesepod_A0397pb.mp3 'Requesting A Fork'
mv chinesepod_A0402pb.mp3 'Turn On The Air Conditioning'
mv chinesepod_A0406pb.mp3 'Dont Drink The Water'
mv chinesepod_A0409pb.mp3 'How Long In China'
mv chinesepod_A0411pb.mp3 'Can I Smoke Here'
mv chinesepod_A0416pb.mp3 'Its Snowing'
mv chinesepod_A0425pb.mp3 'Valentines Day Gift'
mv chinesepod_A0431pb.mp3 'Power Outage'
mv chinesepod_A0434pb.mp3 'Buying Bread And Butter'
mv chinesepod_A0437pb.mp3 'Wait For Me Here'
mv chinesepod_A0439pb.mp3 'Lost Keys'
mv chinesepod_A0444pb.mp3 'Riding The Elevator'
mv chinesepod_A0451pb.mp3 'Colored Balls'
mv chinesepod_A0455pb.mp3 'Emergency Call'
mv chinesepod_A0458pb.mp3 'St Patricks Day'
mv chinesepod_A0460pb.mp3 'Wrong Number'
mv chinesepod_A0465pb.mp3 'Just Looking'
mv chinesepod_A0469pb.mp3 'Please Let Me Through'
mv chinesepod_A0472pb.mp3 'Didnt Hear Clearly'
mv chinesepod_A0474pb.mp3 'Get Up'
mv chinesepod_A0478pb.mp3 'For You And You And You'
mv chinesepod_A0480pb.mp3 'Wireless Internet'
mv chinesepod_A0484pb.mp3 'Head Shoulders Knees And Toes'
mv chinesepod_A0490pb.mp3 'Calling Roll'
mv chinesepod_A0494pb.mp3 'Quiet For The Baby'
mv chinesepod_A0497pb.mp3 'Requesting A Glass Of Water'
mv chinesepod_A0501pb.mp3 'Internet Cafe Rates'
mv chinesepod_A0505pb.mp3 'Colors Song'
mv chinesepod_A0509pb.mp3 'Mosquitoes'
mv chinesepod_A0513pb.mp3 'Wheres The Bus Stop'
mv chinesepod_A0517pb.mp3 'Cold Beer'
mv chinesepod_A0521pb.mp3 'Wrong Change'
mv chinesepod_A0523pb.mp3 'Whats That Smell'
mv chinesepod_A0527pb.mp3 'What Stop Is This'
mv chinesepod_A0532pb.mp3 'Giving An Example'
[demo@localhost Bash]$
You will need single quotes to surround the new file names because they contain white spaces. If you are satisfied with the above output then simply do this:

while read old_name new_name; do echo "mv $old_name '$new_name'"; done < songs.txt >
The output is redirected to a file and you can run it to change the file names:

[demo@localhost Bash]$ /bin/bash 
mv: cannot stat `chinesepod_A0001pb.mp3': No such file or directory
mv: cannot stat `chinesepod_A0002pb.mp3': No such file or directory
Those files do not exist on my system.

Well, you can change the "echo" statement from the command so that the files are renamed instantly.

Here it is:

do eval $(echo "mv $old_name '$new_name'");
In Action:

[demo@localhost Bash]$ touch 1 2 3
[demo@localhost Bash]$ cat songs.txt 
1	One and One
2	Two and Two
3	Three and Three

[demo@localhost Bash]$ while read old_name new_name; do eval $(echo "mv $old_name '$new_name'"); done < songs.txt
[demo@localhost Bash]$ ls -ltr | tail -n 3
-rw-rw-r--. 1 demo demo    0 Jan 15 19:05 Two and Two
-rw-rw-r--. 1 demo demo    0 Jan 15 19:05 Three and Three
-rw-rw-r--. 1 demo demo    0 Jan 15 19:05 One and One
[demo@localhost Bash]$

Last edited by devUnix; 01-15-2012 at 07:39 AM.
Old 01-15-2012, 10:04 AM   #5
Registered: Oct 2010
Location: Bengaluru, India
Distribution: RHEL 5.1 on My PC, & SunOS / Sun Solaris, RHEL, SuSe, Debian, FreeBSD and other Linux flavors @ Work
Posts: 593

Rep: Reputation: 59
By the way, from where did you download those music files?
Old 01-15-2012, 11:05 AM   #6
Registered: Jan 2010
Distribution: Ubuntu
Posts: 97

Original Poster
Rep: Reputation: 4
Thank you

Thank you Dark_Helmet! I ended up using the output from the echo command as the basis of a new script. I know it was not the way that you described but that is just the way I work sometimes...

As for DevUnix, sorry man or lady. I found a Chinese lesson website that had single click mp3 link downloads. I decided to view the source file and sure enough it had the full http URLs for the files. I decided that it would be faster to edit the source file in Linux, remove all of the crap and just have the URLs left. While I was playing with the script given to me by Dark_Helmet I accidentally deleted all of my files in the HOME dir. Buh-bye file with pure http URLs. As a constellation prize I have attached the original source file. Enjoy!
Attached Files
File Type: txt MP3*Chinese*Lessons.txt (221.5 KB, 13 views)
Old 01-15-2012, 12:50 PM   #7
Registered: Oct 2010
Location: Bengaluru, India
Distribution: RHEL 5.1 on My PC, & SunOS / Sun Solaris, RHEL, SuSe, Debian, FreeBSD and other Linux flavors @ Work
Posts: 593

Rep: Reputation: 59
Here is the list of the songs that can be downloaded:

And here is the list of the file names:

chinesepod_A0001pb.mp3 Good Morning
chinesepod_A0002pb.mp3 Whats Your Name
chinesepod_A0003pb.mp3 Where Are You From
chinesepod_A0004pb.mp3 Do You Like China
chinesepod_A0005pb.mp3 Do You Have A Menu
chinesepod_A0006pb.mp3 I Want To Buy This One
chinesepod_A0024pb.mp3 Colors
chinesepod_A0031pb.mp3 All In The Family
chinesepod_A0033pb.mp3 Paying The Bill
chinesepod_A0037pb.mp3 Dialect Party Mix
chinesepod_A0044pb.mp3 Friends For Dinner
chinesepod_A0045pb.mp3 Long Time No See
chinesepod_A0048pb.mp3 A Correction Of Tones
chinesepod_A0051pb.mp3 How You Doin
chinesepod_A0052pb.mp3 What Are Your Hobbies
chinesepod_A0053pb.mp3 Taxi Conversations Destination
chinesepod_A0058pb.mp3 Too Many Cooks
chinesepod_A0061pb.mp3 Describing The Weather
chinesepod_A0062pb.mp3 Taxi Conversations Suggesting A Route
chinesepod_A0064pb.mp3 Lying In Chinese
chinesepod_A0065pb.mp3 Taxi Conversations Arriving At Your Destinati
chinesepod_A0067pb.mp3 Hotel Motel Holiday Inn
chinesepod_A0071pb.mp3 Useful Phrases1
chinesepod_A0073pb.mp3 New Year
chinesepod_A0077pb.mp3 Explaining Your Occupation
chinesepod_A0080pb.mp3 Useful Phrases2
chinesepod_A0083pb.mp3 Im Not Hungry
chinesepod_A0088pb.mp3 Marriage And Divorce
chinesepod_A0090pb.mp3 University Major Part1
chinesepod_A0092pb.mp3 Surfing The Internet
chinesepod_A0094pb.mp3 Sending Emails
chinesepod_A0095pb.mp3 Addresses
chinesepod_A0097pb.mp3 Invitations To Eat
chinesepod_A0099pb.mp3 Asking For Favors
chinesepod_A0103pb.mp3 Buying Train Tickets
chinesepod_A0108pb.mp3 Baby Talk Words Of Comfort
chinesepod_A0109pb.mp3 Singing Ability
chinesepod_A0110pb.mp3 University Major Part2
chinesepod_A0113pb.mp3 Talking About Your Hometown
chinesepod_A0117pb.mp3 You Look Nervous
chinesepod_A0119pb.mp3 Chatting Online
chinesepod_A0121pb.mp3 Drive Faster
chinesepod_A0122pb.mp3 What Time Is It
chinesepod_A0124pb.mp3 Too Polite
chinesepod_A0126pb.mp3 Baby Talk Be Good
chinesepod_A0128pb.mp3 Your Receipt
chinesepod_A0130pb.mp3 I Dont Feel Well
chinesepod_A0133pb.mp3 Downloading Music
chinesepod_A0134pb.mp3 Youre Late Again
chinesepod_A0136pb.mp3 Its Broken
chinesepod_A0138pb.mp3 Definitely
chinesepod_A0140pb.mp3 Baby Talk Praise
chinesepod_A0142pb.mp3 How Are You
chinesepod_A0145pb.mp3 Baby Talk Eat Up
chinesepod_A0147pb.mp3 I Miss You
chinesepod_A0150pb.mp3 Whats His Name
chinesepod_A0152pb.mp3 She Went Out
chinesepod_A0155pb.mp3 I Like Beef
chinesepod_A0159pb.mp3 World Cup Football Terms
chinesepod_A0163pb.mp3 Wheres The Bathroom
chinesepod_A0165pb.mp3 Allergies
chinesepod_A0168pb.mp3 Finding A Seat
chinesepod_A0172pb.mp3 Exchanging Money
chinesepod_A0175pb.mp3 Vegetarian Eating
chinesepod_A0180pb.mp3 May I Take Your Photo
chinesepod_A0184pb.mp3 Finding A Cheap Hostel
chinesepod_A0186pb.mp3 Transportation
chinesepod_A0191pb.mp3 Using A Credit Card
chinesepod_A0196pb.mp3 How Do You Say
chinesepod_A0200pb.mp3 Im Here For An Interview
chinesepod_A0205pb.mp3 What Is This Called
chinesepod_A0209pb.mp3 Too Expensive
chinesepod_A0213pb.mp3 No Thank You
chinesepod_A0218pb.mp3 Little Friends
chinesepod_A0221pb.mp3 I Love China
chinesepod_A0226pb.mp3 Lost Luggage
chinesepod_A0229pb.mp3 Stomach Trouble
chinesepod_A0235pb.mp3 Mailing A Letter
chinesepod_A0239pb.mp3 What Character
chinesepod_A0242pb.mp3 Hotel Essentials
chinesepod_A0247pb.mp3 The Olympics
chinesepod_A0253pb.mp3 Baby Talk Friends Song
chinesepod_A0257pb.mp3 Im Hungry
chinesepod_A0263pb.mp3 Ouch
chinesepod_A0268pb.mp3 Wheres The Garbage
chinesepod_A0272pb.mp3 Business Cards
chinesepod_A0277pb.mp3 Black Or Green Tea
chinesepod_A0281pb.mp3 Feminine Products
chinesepod_A0286pb.mp3 Im Cold
chinesepod_A0290pb.mp3 Stopping The Taxi
chinesepod_A0296pb.mp3 Asking For Change
chinesepod_A0301pb.mp3 The Door
chinesepod_A0304pb.mp3 Playing Cards
chinesepod_A0308pb.mp3 A Late Knock
chinesepod_A0311pb.mp3 A Startled Friend
chinesepod_A0316pb.mp3 Thirsty For Water
chinesepod_A0323pb.mp3 Stand Up
chinesepod_A0329pb.mp3 This Is Mine
chinesepod_A0333pb.mp3 Happy Birthday
chinesepod_A0338pb.mp3 Please Speak Slowly
chinesepod_A0343pb.mp3 Im Not Chinese
chinesepod_A0346pb.mp3 At The Zoo
chinesepod_A0351pb.mp3 Being Seated In A Restaurant
chinesepod_A0354pb.mp3 Feeling Nauseous
chinesepod_A0358pb.mp3 Im Really Full
chinesepod_A0361pb.mp3 Asking For Help
chinesepod_A0365pb.mp3 I Got Married
chinesepod_A0368pb.mp3 I Cant Sing
chinesepod_A0372pb.mp3 What Are You Doing
chinesepod_A0376pb.mp3 Asking The Bus Destination
chinesepod_A0381pb.mp3 Simple Toasts
chinesepod_A0383pb.mp3 Noodles Without Cilantro
chinesepod_A0386pb.mp3 so There
chinesepod_A0389pb.mp3 Have You Eaten
chinesepod_A0393pb.mp3 Going On Vacation
chinesepod_A0397pb.mp3 Requesting A Fork
chinesepod_A0402pb.mp3 Turn On The Air Conditioning
chinesepod_A0406pb.mp3 Dont Drink The Water
chinesepod_A0409pb.mp3 How Long In China
chinesepod_A0411pb.mp3 Can I Smoke Here
chinesepod_A0416pb.mp3 Its Snowing
chinesepod_A0425pb.mp3 Valentines Day Gift
chinesepod_A0431pb.mp3 Power Outage
chinesepod_A0434pb.mp3 Buying Bread And Butter
chinesepod_A0437pb.mp3 Wait For Me Here
chinesepod_A0439pb.mp3 Lost Keys
chinesepod_A0444pb.mp3 Riding The Elevator
chinesepod_A0451pb.mp3 Colored Balls
chinesepod_A0455pb.mp3 Emergency Call
chinesepod_A0458pb.mp3 St Patricks Day
chinesepod_A0460pb.mp3 Wrong Number
chinesepod_A0465pb.mp3 Just Looking
chinesepod_A0469pb.mp3 Please Let Me Through
chinesepod_A0472pb.mp3 Didnt Hear Clearly
chinesepod_A0474pb.mp3 Get Up
chinesepod_A0478pb.mp3 For You And You And You
chinesepod_A0480pb.mp3 Wireless Internet
chinesepod_A0484pb.mp3 Head Shoulders Knees And Toes
chinesepod_A0490pb.mp3 Calling Roll
chinesepod_A0494pb.mp3 Quiet For The Baby
chinesepod_A0497pb.mp3 Requesting A Glass Of Water
chinesepod_A0501pb.mp3 Internet Cafe Rates
chinesepod_A0505pb.mp3 Colors Song
chinesepod_A0509pb.mp3 Mosquitoes
chinesepod_A0513pb.mp3 Wheres The Bus Stop
chinesepod_A0517pb.mp3 Cold Beer
chinesepod_A0521pb.mp3 Wrong Change
chinesepod_A0523pb.mp3 Whats That Smell
chinesepod_A0527pb.mp3 What Stop Is This
chinesepod_A0532pb.mp3 Giving An Example

You can use wget in a loop to download them all without manually downloading them one by one.

for LINK in `cat /tmp/songs.urls`; do echo "Downloading: $LINK"; wget -q $LINK; [ $? -eq 0 ] && echo "Succeeded" || echo "Failed" ; done

By the way, I am a guy.

Last edited by devUnix; 01-15-2012 at 12:58 PM.
Old 01-15-2012, 01:35 PM   #8
Registered: Jan 2010
Distribution: Ubuntu
Posts: 97

Original Poster
Rep: Reputation: 4

I just used the file with the http URLs and used
wget -i FILENAME
Old 01-15-2012, 03:23 PM   #9
Registered: Oct 2010
Location: Bengaluru, India
Distribution: RHEL 5.1 on My PC, & SunOS / Sun Solaris, RHEL, SuSe, Debian, FreeBSD and other Linux flavors @ Work
Posts: 593

Rep: Reputation: 59
Originally Posted by lonesoac0 View Post
I just used the file with the http URLs and used
wget -i FILENAME
Well, in your case it works because luckily the links to MP3 files are absolute paths. Otherwise, you would need "-b" or "--base=URL" to resolve relative paths problems.


bash, rename, scripting

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
Mass Renaming Files SlowCoder Linux - General 9 03-16-2010 10:47 PM
mass renaming in order KBriggs Linux - Newbie 5 06-17-2009 12:02 PM
Mass renaming? yanik Linux - General 6 02-16-2009 03:25 PM
mass renaming script frieza Programming 25 12-10-2007 03:56 AM
a question about renaming files in mass! zeltak Linux - Software 1 05-24-2006 06:12 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:06 AM.

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