Sponsored Content
Top Forums Shell Programming and Scripting help using find/xargs to apply mp3gain to files Post 302603340 by audiophile on Wednesday 29th of February 2012 06:36:19 PM
Old 02-29-2012
help using find/xargs to apply mp3gain to files

I need to apply mp3gain (album mode) to all mp3 files in a given directory. Each album is in its own directory under /media/data/music/albums for example:

Code:
/media/data/music/albums/foo
/media/data/music/albums/bar
/media/data/music/albums/more

What needs to happen is:
Code:
cd /media/data/music/albums/foo && mp3gain -a -k -p *.mp3
cd /media/data/music/albums/bar && mp3gain -a -k -p *.mp3
cd /media/data/music/albums/more && mp3gain -a -k -p *.mp3

I want to use find and xargs to do this but am unsure how to craft the right syntax. I have used the this construct to accomplish tasks like this before, but this won't do both the cd into the dir and then run the mp3gain command.

Code:
find /media/data/music/album -type d -print0 | xargs -0 cd {} && mp3gain -a -k -p *.mp3

Thanks!
 

10 More Discussions You Might Find Interesting

1. Linux

How to find and apply patches in RHAT linux?

Hi: This is an elementary qs. Thanks in advance, (4 Replies)
Discussion started by: bbose
4 Replies

2. Shell Programming and Scripting

Script to find/apply Solaris 10 ACL's

This may be a question for a different forum, but as I will need a script I thought I would start here. We recently migrated from Solaris 8 to Solaris 10. The file system in question here is ZFS, meaning the method for listing and applying ACL's has changed dramatically. To make a long story... (3 Replies)
Discussion started by: Shoeless_Mike
3 Replies

3. UNIX for Dummies Questions & Answers

XARGS and FIND together

I am trying to delete files older than 60 days from a folder: find /myfolder/*.dat -mtime +60 -exec rm {} \; ERROR - argument list too long: find I can't just give the folder name, as there are some files that I don't want to delete. So i need to give with the pattern (*.dat). I can... (3 Replies)
Discussion started by: risshanth
3 Replies

4. Shell Programming and Scripting

find with xargs to rm found files

I believe what is happening is rm is executing in the script on every directory and on failure of the first it stops although returns status 0. find $HOME -name /directory/filename | xargs -l rm This is the code I use but file remains. I am using sun solaris system which has way limited... (4 Replies)
Discussion started by: Ebodee
4 Replies

5. Shell Programming and Scripting

find and xargs

hi, i've been trying to figure this weird error but I cannot seem to know why. I am using below find command: find . \( ! -name . -prune \) -type f -mtime +365 -print The above code returns no file because no files are really more then 365 days old. However, when I use xargs, its... (9 Replies)
Discussion started by: The One
9 Replies

6. Shell Programming and Scripting

Apply 'awk' to all files in a directory or individual files from a command line

Hi All, I am using the awk command to replace ',' by '\t' (tabs) in a csv file. I would like to apply this to all .csv files in a directory and create .txt files with the tabs. How would I do this in a script? I have the following script called "csvtabs": awk 'BEGIN { FS... (4 Replies)
Discussion started by: ScKaSx
4 Replies

7. Shell Programming and Scripting

Xargs + Find Help

Guys i want to run a command to list all directories that havn't been modified in over 548 days ( 1.5 yrs ). Id like to run a script to first print what the command finds ( so i get a list of the files pre move ... i have a script set for this : find /Path/Of\ Target/Directory/ -type d -mtime... (4 Replies)
Discussion started by: modulartention
4 Replies

8. UNIX for Dummies Questions & Answers

find/xargs/*grep: find multi-line empty "try-catch" blocks - eg, missing ; not in a commented block

How can I recursively find all files in a directory and print out the file and first line number of any text blocks that match the below cases? This would seem to involve find, xargs, *grep, regex, etc. In summary, I want to find so-called empty "try-catch blocks" that do not contain code... (0 Replies)
Discussion started by: lifechamp
0 Replies

9. Shell Programming and Scripting

Help with find, xargs and awk

Hi, I want to find some files and then search for some lines in it with a particular pattern and then write those lines into a file. To do this I am using something like this from command prompt directly. cd /mdat/BVG find -name "stmt.*cl" -newer temp.txt | xargs -i awk '/BVG-/{print}' {} >... (7 Replies)
Discussion started by: Sandhya Harsh
7 Replies

10. Shell Programming and Scripting

Fast processing(mv command) of 1 million+ files using find, mv and xargs

Hi, I'd like to ask if anybody can help improve my code to move 1 million+ files from a directory to another: find /source/dir -name file* -type f | xargs -I '{}' mv {} /destination/dir I learned this line of code from this forum as well and it works fine. However, file movement is kinda... (6 Replies)
Discussion started by: agentgrecko
6 Replies
REPLAYGAIN(1)							       rgain							     REPLAYGAIN(1)

NAME
replaygain - single file Replay Gain editor SYNOPSIS
replaygain [options] AUDIO_FILE [AUDIO_FILE ...] replaygain --help replaygain --version DESCRIPTION
replaygain applies or displays Replay Gain information for audio files. OPTIONS
--version Display the version of the software. -h, --help Display a short documentation. -f, --force Recalculate Replay Gain even if the file already contains gain information. -d, --dry-run Don't actually modify any files. -r REF, --reference-loudness=REF Set the reference loudness to REF dB (default: 89 dB) --mp3-format=MP3_FORMAT Choose the Replay Gain data format for MP3 files. Since there is no commonly accepted standard for Replay Gain in MP3 files, you need to choose. Possible formats are : o ql (used by Quod Libet). This is the default value. o fb2k (read and written by foobar2000, also understood by Quod Libet) o mp3gain (tags as written by the mp3gain program; this doesn't modify the MP3 audio data as said program does). --no-album Don't write any album gain information. --show Don't calculate anything, simply show Replay Gain information for the specified files. In this mode, all options other than --mp3-format are ignored. SEE ALSO
collectiongain(1) 1.0 2011-11-26 REPLAYGAIN(1)
All times are GMT -4. The time now is 02:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy