mysql-torrent-import.sh

!#/bin/bash
MYSQLUSER = 'mysqlusername'
MYSQLPASS = 'mysqlpass'
for f in /path/to/site/backtorrents/*
do
  filename=$(basename "$f")
  filename="${filename%.*}"
  sed -i 's/8:announce36:http:\/\/www.myspleen.org\/announce.php//g' /path/to/site/backtorrents/${f}
  mysql -u${MYSQLUSER} -p${MYSQLPASS} -e "INSERT INTO ${database}.torrents_files (TorrentID, File) VALUES (${filename}, LOAD_FILE('/path/to/site/backtorrents/${f}));"
done