Need assistance with simple shell script to organize files. [Code attached]

I need some help with this shell script for class. All it does is organize your files. It works, but in the log file, it needs to show the new filepaths of the moved files. Heres my log of my output:

Starting to organize...
movie2.wmv --> 
movie3.mov --> 
movie1.mpg --> 
song1.mp3 --> 
song2.mp3 --> 
file1.txt --> 
final.txt --> 
grades.txt --> 
secretfile.txt --> 

Where the arrows are, I need to print the filepath of the new files. So it would look something like this:

movie2.wmv-->  movies/movie2.wmv

Thank You for any help!
-Ryan

#!/bin/sh

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

read ANSWER
echo "You answered $ANSWER"

if [ $ANSWER == "Y" ] || [ $ANSWER == "y" ]; then
echo "Organizing files!"

touch organize.log
echo "Starting to organize..." > organize.log

mkdir movies

for filename in *.wmv
do
  mv $filename movies
  echo "$filename --> " >> organize.log
done

for filename2 in *.mov
do
  mv $filename2 movies
  echo "$filename2 --> " >> organize.log
done
  
for filename3 in *.mpg
do  
  mv $filename3 movies
  echo "$filename3 --> " >> organize.log
done
  
mkdir songs

for filename4 in *.mp3
do
  mv $filename4 songs
  echo "$filename4 --> " >> organize.log
done
  
for filename5 in *.wma
do
  mv $filename5 songs
  echo "$filename5 --> " >> organize.log
done
   
mkdir textfiles
  
for filename6 in *.txt
do
  mv $filename6 textfiles
  echo "$filename6 --> " >> organize.log
done
  
echo "Finished organizing files!"
echo "Bye!"

else
  echo "User cancelled the process."
  exit
fi
  
exit
for filename in *.wmv
do
  mv $filename movies
  echo "$filename --> movies/$filename" >> organize.log
done

or let mv work in verbose mode, and redirect it.

mv -v $finame movies >> organize.log 

Example:

mv -v testfile testdir/
`testfile' -> `testdir/testfile'

Thank You sir!

I appreciate it, this is due Monday night for class and has stumped me. I was proud of it with having only a lousy powerpoint file to work with.

Thanks :slight_smile:

Posting Homework in the main forums is not allowed. Thread closed.