Claim your Biolink Click Here
2 like 0 dislike
414 views
in Education & Reference by (1.1k points) | 414 views

2 Answers

2 like 0 dislike
Best answer

Better way

#!/bin/sh
for file in $(find /path/ -name "*.wav" | sed 's/\.[^.]*$//')
do
        echo $file
        name=${file%%.wav}
        echo $name
        lame -V0 -h -b 160 --vbr-new $name.wav $name.mp3
        #chk_mp3=$(find /path/ -name "*.mp3")
        chk_mp3=$(find $name.mp3)
        echo $chk_mp3
        if [ "$chk_mp3" == "$name.mp3" ];then
                rm $file.wav
                echo "file $file found and removed";
        else
                echo "file not found"
        fi
        
done
by
selected by
0 like 0 dislike

BASH SCRIPT save with .sh and run by sh filename.sh

#!/bin/bash

SAVEIF=$IFS
IFS=$(echo -en "\n\b")
for file in $(locate wav |grep path/to/folder)
do
  name=${file%%.wav}
  lame -V0 -h -b 160 --vbr-new $name.wav $name.mp3
  rm $name.wav
done

IFS=$SAVEIFS
by (830 points)

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
1 like 0 dislike
1 answer
1 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
1 like 0 dislike
1 answer
asked Oct 26, 2017 in Education & Reference by Sam (1.6k points) | 214 views

Where your donation goes
Technology: We will utilize your donation for development, server maintenance and bandwidth management, etc for our site.

Employee and Projects: We have only 15 employees. They are involved in a wide sort of project works. Your valuable donation will definitely boost their work efficiency.

How can I earn points?
Awarded a Best Answer 10 points
Answer questions 10 points
Asking Question -20 points

1,312 questions
1,473 answers
569 comments
4,809 users