#!/bin/bash
# status: hurt me plenty   <- make a BACKUP!
 
action=${1-'echo'}
dir="$2"
dir2="$3"
 
find $dir -type f | while read f; do
 
    a=$( basename "$f" )
    dn=$( dirname "$f" )
    #dokuwiki compatible filenames
    b=`expr "xxx$a" : 'xxx\(.*\)' | sed 's/@/at/' | tr '[A-Z]' '[a-z]' | tr -cs '[:alnum:]_\-.\n' '_' `
    odir=$dir2${dn#$dir}
 
    if [ $action == "ffmpeg" ]; then
        [ -d "$odir" ] || mkdir -p $odir
        echo 'ffmpeg -y -i "'$f'" -acodec vorbis "'$odir'/'$b.ogg'"'
        #ffmpeg -ab 160k -y -i "$f" -acodec vorbis "$odir/$b.ogg"
    else                                                                                                                                         
        echo "$f -> $odir/$b.ogg"
    fi
  done

Log In