diff --git a/convert.sh b/convert.sh index 090047e..a721faa 100755 --- a/convert.sh +++ b/convert.sh @@ -2,15 +2,11 @@ trap 'exit 2' TERM INT -for f in /media/**/*.{avi,ogm,wmv}; do +shopt -s globstar +shopt -s nullglob +for f in **/*.{avi,ogm,wmv}; do printf '\033[1;34;40m' echo "Converting $f" printf '\033[0m' - avconv -i "$f" -strict experimental -c:v libx264 "${f%.avi}.mp4" && rm "$f" -done -for f in /media/*.{avi,ogm,wmv}; do - printf '\033[1;34;40m' - echo "Converting $f" - printf '\033[0m' - avconv -i "$f" -strict experimental -c:v libx264 "${f%.avi}.mp4" && rm "$f" + avconv -i "$f" -strict experimental -c:v libx264 "${f:0:-4}.mp4" && rm "$f" done