Hello Group,
Once again another script hacked together from a few sources to try and suit my needs. This is to go through a /temp directory and for each ls entry ask which Dir of three I want it sorted.
The script works but there are a few behaviors that are odd so I figured I'd ask for help cleaning this up. The first issue is it continues to ask to move the file even if you have answered yes prior, which should cause an error but instead it just happily copies it to both, or all three which is really weird. I'd like it to stop after one affirmative answer or better yet if its easier & someone can show me how it could be one read with a (M)ovie (T)elevision or (K)ids prompt & and three $replys looking for first corresponding letters . I just wasn't able to figure that out for the life of me.
Here it is: TIA to all, this is my goto group for this stuff, since I'm obviously not a coder.
#/bash
for files in `cd /mnt/storage/media/temp/; ls`; do
echo "Found: /mnt/storage/media/temp/"$files;
read -p "Move to movies (y/n)?"
[ "$REPLY" == "n" ] || mv /mnt/storage/media/temp/$files /mnt/storage/media/Video/movies/$files
read -p "Move to Mike (y/n)?"
[ "$REPLY" == "n" ] || mv /mnt/storage/media/temp/$files /mnt/storage/media/Video/mike/$files
read -p "Move to TV (y/n)?"
[ "$REPLY" == "n" ] || mv /mnt/storage/media/temp/$files /mnt/storage/media/Video/television/$files
done