LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-06-2004, 06:38 PM   #1
bendeco13
Member
 
Registered: Oct 2004
Distribution: Fedora 7
Posts: 232

Rep: Reputation: 30
Question Bash Scripting (subdirectories)


I wrote a very simple bash script to remove all mp3 tags from a given directory using id3ed, but I was wondering if there is a way to add/modify a command to get it to delete the tags from subdirectories as well.
Here's what I got right now.
__________________________________________________

#
# Removes id3 tags using id3ed
#
clear
echo "This will remove id3 tags from a given directory."
echo "Enter Directory"
read DIR
for file in $DIR*.mp3; do id3ed -r "$file"; done
__________________________________________________

I know it should have something to do with this command, but I don't know how or where to add it to the script:

find . *.mp3

p.s. (I hate id3 tags)

I used to use a program called id3kill for windows, which was awesome, but I can't find anything similar for linux. I've been trying to write a c program, but I don't really have the knowledge or time to right now. Does anyone know of a similar program for linux? I've googled and everything. I've found plenty of id3 editors which also remove tags, but they won't do subdirectories, which is annoying when you have lots of mp3 files.

Thanks in advance !!!
 
Old 10-06-2004, 06:43 PM   #2
Samsara
Member
 
Registered: May 2003
Distribution: Ubuntu, Mac OS X Tiger
Posts: 481

Rep: Reputation: 32
Re: Bash Scripting (subdirectories)

for file in `find ./ | grep ".mp3"`; do ...

should work (untested)

Regards,

Samsara
 
Old 10-06-2004, 08:57 PM   #3
amfoster
Member
 
Registered: Aug 2004
Distribution: debian, SuSE
Posts: 365

Rep: Reputation: 36
The find command can be used with xargs or the exec command as well

example
find / -name *.mp3 -exec somecommand {} \;

will do somecommand for every file it finds.

Substitute ok for exec and you will be prompted to do the action for each file you find.
 
Old 10-06-2004, 09:55 PM   #4
bendeco13
Member
 
Registered: Oct 2004
Distribution: Fedora 7
Posts: 232

Original Poster
Rep: Reputation: 30
O.K. seems to work fine for files that don't have spaces. Is there a way to bypass these spaces and include those files as well?

This is what I got right now:
________________________________________________

#
# Removes id3 tags using id3ed
#
clear
echo "This will remove id3 tags from a given directory."
echo "Enter Directory"
read DIR
LIST=`find $DIR -name "*.mp3"`
id3ed -r $LIST
________________________________________________

There's gotta be a way to add the ' ' to the LIST generated by the find function, but I can't figure out how.

Last edited by bendeco13; 10-06-2004 at 10:54 PM.
 
Old 10-07-2004, 12:24 AM   #5
bendeco13
Member
 
Registered: Oct 2004
Distribution: Fedora 7
Posts: 232

Original Poster
Rep: Reputation: 30
Wink

O.K. It finally works...
This is what I ended up with.

___________________________________________________

#
# Removes id3 tags using id3ed
#
clear
echo "This will remove id3 tags from a given directory."
echo "Enter Directory (Don't Use Quotes)"
read DIR
find "$DIR" -name "*.mp3" | while read list
do
id3ed -r "$list"
done
___________________________________________________

Thanks for everyones replies.....
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Bash, Find script files in a directory or subdirectories within... ray5_83 Programming 4 10-10-2008 07:42 PM
Bash scripting pete1234 Programming 1 09-27-2005 01:48 AM
bash scripting.. kurrupt Programming 3 09-21-2005 12:07 AM
bash scripting fnoyan Programming 1 01-18-2005 07:35 AM
Bash scripting SWAT Linux - Newbie 2 11-11-2003 03:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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