LinuxQuestions.org
Visit Jeremy's Blog.
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 06-26-2004, 10:04 AM   #1
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092
Blog Entries: 1

Rep: Reputation: 90
Question find -exec question


Hi, guys!

Let's see if there's smebody who can help me on this:

I have a number of mp3 files I want to re-rip because the volume is too low. In order to do that I have everything: One player, one normalizer and one encoder.

i could simply do:

Code:
mpg123 -s a.mp3 | normalize min=98 | lame -x -v -V 2 -b 32 -B 320 - temp.mp3
mv -f temp.mp3 a.mp3
That works just PERFECT

However I don't want to have to type it over and over again (once for each of the 50 files I want to re-rip)

I decided to use find -exec to get it done.... however when I try to do it (have tried in a number of different ways already), It doesn't seem to "understand" the "pipes" nor the separation between de ripping and the moving commands (two command instead of one)

Can anybody tell me how I could get it done with find?

Thanks!
 
Old 06-26-2004, 10:57 AM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Put the command sequence in a shell script, and have find execute the shell script. For instance, put this in a file named re_rip.bash:
Code:
#!/bin/bash

# Only do something if we are given an argument on the command line
if [ ! "${1}x" = "x" ] ; then

  mpg123 -s ${1} | normalize min=98 | lame -x -v -V 2 -b 32 -B 320 - temp.mp3

  mv temp.mp3 ${1}
fi
Save the file, make it executable (chmod u+x re_rip.bash), and then run the find command:

find dir options -exec /path/to/re_rip.bash {} \;

Whenever automating moving/deleting files, always always always copy a subset of the data to a test location and give the script a trial run. If it works on your test, then cut it loose on your regular stuff.
 
  


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
how can I execute two commands on exec of a find? eantoranz Programming 3 08-03-2010 04:51 PM
find: missing argument to `-exec' pavodive Linux - Newbie 4 10-05-2009 02:24 PM
redhat 9.0 how to use the command 'find' with the action -exec arvin_shu Linux - Newbie 3 11-30-2005 07:09 AM
Help sought with 'find -exec' drjones69 Linux - Software 2 04-27-2005 04:02 AM
find -exec cricbk Linux - Newbie 4 01-05-2004 07:03 PM

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

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