This is probably not as difficult as I'm making it, but I was wondering if anyone else might have some suggestions.
Here's what I want to do:
I'm trying to write a script to check a directory for a specific filetype (.torrent in this case) and then prompt for a directory to move each file to, one by one.
so if the script finds:
Code:
foo.torrent
foobar.torrent
foobarmoo.torrent
it will then ask which directory I want to move foo.torrent too, do that then move on to the next one.
so far I have:
Code:
#!/bin/bash
SAVE_DIR ~/Desktop
cd $SAVE_DIR
ls *.torrent >> ~/.torrent_list
some parsing command here that outputs 1st .torrent as FILE
echo "select an option"
echo "[1] music"
echo "[2] movies"
echo "[3] tv"
echo "[4] software"
echo "[5] misc"
read CHOICE
case "$CHOICE" in
"1" )
mv $FILE ~/.rtorrent/music/
;;
"2" )
mv $FILE ~/.rtorrent/movies/
;;
"3" )
mv $FILE ~/.rtorrent/tv/
;;
"4" )
mv $FILE ~/.rtorrent/software/
;;
"5" )
mv $FILE ~/.rtorrent/misc/
;;
esac
rm ~/.torrent_list
exit
basically I need something that can parse the created file and stop after finding the first .torrent file. from there I think the rest should work. I tested what I could and it moves the files fine.
Any suggestions would be appreciated. This is definitely not anything important, just a time saver (well, once I get it working anyway )
Bookmarks