How to create a log file that simply shows the name of a file and what directory it was moved to.

Newbie...Thank you for your help.

I am creating my first script that simply generates subdirectories to organize video, music, and text files within those subdirectories from my current working directory.

PROBLEM: I am trying to write a log file that contains, for each file, the original file name, as well as the new file path/name it was moved to. I think it has something to do with redirect operators, but I do not know where to start.

Here is what the sample output should look like, and my current code is listed below that. My current code works but as of now, it only creates the subdirectories and moves the files within those subdirectories.

SAMPLE RUN:

name@school.edu:~/testsuite> ./organizefiles.sh
Are you sure you want to reorganize your files?
Enter y to continue, anything else to cancel:
y
Organizing files!
Finished organizing files!
Bye!


name@school.edu:~/testsuite> ls -R
.:
movies organizefiles.sh organize.log songs textfiles
./movies:
coolclip.wmv movie1.wmv movie2.mpg myvideo.mov
./songs:
awesomesong.mp3 jazz.mp3 rock.mp3 song1.wma song2.mp3
./textfiles:
file1.txt final.txt grades.txt secretdoc.txt


name@school.edu:~/testsuite> cat organize.log
Starting to organize...
coolclip.wmv --> movies/coolclip.wmv
movie1.wmv --> movies/movie1.wmv
movie2.mpg --> movies/movie2.mpg
myvideo.mov --> movies/myvideo.mov
awesomesong.mp3 --> songs/awesomesong.mp3
jazz.mp3 --> songs/jazz.mp3
rock.mp3 --> songs/rock.mp3
song1.wma --> songs/song1.wma
song2.mp3 --> songs/song2.mp3
file1.txt --> textfiles/file1.txt
final.txt --> textfiles/final.txt
grades.txt --> textfiles/grades.txt
secretdoc.txt --> textfiles/secretdoc.txt
name@school.edu:~/testsuite>

MY CURRENT CODE:

name@shell:~/coursename/scriptpractice>cat organizefiles.sh
#!/bin/sh
# Script to reorganize files

echo "Are you sure you want to reorganize your files?"
echo "Enter y to continue, anything else to cancel: "

read ans # This will get the user's response into the variable "ans"

case $ans in # Dereferencing ans. In is just syntax.

        # If the user says yes
        "y")
                echo "Organizing files!"
                        mkdir music video text
                        mv *.mp3 *.ogg *.wav ./music
                        mv *.wmv *.mov *.mpg ./video
                        mv *.txt ./text
                # Log file "organize.log" created
                        # for FILENAME in *
                echo "Finished organizing files!"
                echo "Bye!"
                ;;

        # If the user says anything else
        *) # * is a wildcard
                echo "User cancelled the process."

esac # As with the if statement, the case statement ends with case in reverse...esac