2 like 0 dislike
194 views
in Education & Reference by (820 points) | 194 views

2 Answers

1 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 (630 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
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer

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,227 questions
1,373 answers
559 comments
2,099 users