
#!/bin/bash

array=(`find ./seminary -type f | grep -i 'mp3$'`)
cat /dev/null > audio.csv
audio="AUDIO"
echo $audio ";" >> audio.csv
str0="Seminary"
echo $str0 ";" >> audio.csv
for i in "${array[@]}"
do :
str1="http://openyoga.ru/av_yoga/"
str2="$str1$i"
str3="${str2/"av_yoga/."/av_yoga}"
#str4="<a href=\" "$str3" \">"$str3"<br>"
#    echo $str4 >> audio.html
echo $str3 ";" >> audio.csv
done

array=(`find ./lek -type f | grep -i 'mp3'`)
str0="Lections"
echo $str0 ";" >> audio.csv
for i in "${array[@]}"
do :
str1="http://openyoga.ru/av_yoga/"
str2="$str1$i"
str3="${str2/"av_yoga/."/av_yoga}"
    echo $str3 ";" >> audio.csv

done


array=(`find ./seminary -type f | grep -vi 'mp3$' | grep -vi 'doc$' | grep -vi 'docx$' | grep -vi 'jpg$'`)
cat /dev/null > video.csv
video="VIDEO"
echo $video ";" >> video.csv
str0="Seminary"
echo $str0 ";" >> video.csv
for i in "${array[@]}"
do :
str1="http://openyoga.ru/av_yoga/"
str2="$str1$i"
str3="${str2/"av_yoga/."/av_yoga}"
#str4="<a href=\" "$str3" \">"$str3"<br>"
#    echo $str4 >> audio.html
echo $str3 ";" >> video.csv
done

array=(`find ./lek -type f | grep -iv 'mp3' |  grep -vi 'doc$' | grep -vi 'docx$' | grep -vi 'jpg$'`)
str0="Lections"
echo $str0 ";" >> video.csv
for i in "${array[@]}"
do :
str1="http://openyoga.ru/av_yoga/"
str2="$str1$i"
str3="${str2/"av_yoga/."/av_yoga}"
    echo $str3 ";" >> video.csv

done


