LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-31-2006, 11:30 AM   #1
superior888
LQ Newbie
 
Registered: Jul 2006
Posts: 1

Rep: Reputation: 0
Rename script


Hey!

I have a problem, or not really a problem, but i want some help.

Can someone link to a mp3 organizer script in bash or perl or whatever, that renames files and directories so that spaces gets removed in dirs and files. example:

blink 182 - dude ranch -> Blink_182-Dude_Ranch

Resurcive would be nice to.

Thx.
 
Old 07-31-2006, 11:47 AM   #2
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
find /mnt/mp3player -type f | while read; do mv "$REPLY" "$(echo "$REPLY" | sed -e 's/ /_/g')"; done

And remember: before any run of loop with rm in it, run it with echo rm instead of rm to see what will happen..

edit: added -type f to find, so that directories are not messed up.

Last edited by raskin; 07-31-2006 at 01:48 PM.
 
Old 07-31-2006, 11:53 AM   #3
rickh
Senior Member
 
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250

Rep: Reputation: 62
I have gotten help on this sort of thing several times:
here,
here,
here, and
here.

None of these addresses your particular need, but one or more may get you started until someone else comes along.

Last edited by rickh; 07-31-2006 at 11:55 AM.
 
  


Reply

Tags
renamescript



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
Script to Rename Many Files geeman2.0 Programming 3 04-05-2006 01:45 PM
Help with script to rename shilo Slackware 10 02-04-2006 08:58 AM
File rename script jjwl89 Linux - General 1 03-14-2005 06:28 PM
Script to rename directories superior88 Linux - Newbie 4 02-15-2005 10:31 PM
Need script to rename files joe_stevensen Programming 5 12-05-2003 06:12 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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