function filemove() {
FILE_NAME=$(basename "$1")
if [[ "$FILE_NAME" =~ ^.+\_[0-9]{8}\-.+_.+_.+-.+\.mp3$ ]]; then
FILE_DIR=$(echo $1 | awk -F'[_-]' '{print "/FOLDER/" substr($2,1,4) "/" substr($2,5,2) "/" substr($2,7,9) "/" $5 "/";}');
echo "$FILE_NAME : >> : $FILE_DIR"
echo "---------------------------";
echo -e "creating directory:: \e[1;32m $FILE_DIR\e[0m";
mkdir -p "$FILE_DIR";
echo -e "moving file:: \e[1;32m $FILE_NAME to $FILE_DIR\e[0m";
mv -f "$FILE_NAME" "$FILE_DIR";
else
echo -e "\e[1;31m ::---------------Invalid file name $FILE_NAME---------------:: \e[0m";
fi
echo ""
}
export -f filemove
find /FOLDER/ -maxdepth 1 -type f -name "*.mp3" -exec bash -c "filemove \"{}\"" \;