Moving Files from one directory to another directory

Please do help me out with this. I have to write the following script.

There is a directory named "storage_directory" and it has hundreds of files in it. My script has to move each file from the storage_directory to "temp_directory" After moving each file, it has to create a log of the File name, that is moved into a text file.

Once I run the script, it should be able to move the first file from the "storage_directory" to the "temp_directory" and then create a text file with the name of the files transfered. Then, it has to move the next file in the "storage_directory" to the "temp_directory" and so on... It has to loop through the directory and move the files to "temp_directory"..

mv is destructive, it will delete the original copy after the move, are you sure you don't want to cp first? then rm after you verify the integrity of the file?

#!/bin/ksh

for file in `ls storage_directory`
do
     mv storage_directory/$file temp_directory/$file
     echo "$file has been moved to temp_directory" >> somelogfile.txt
done

Thank You very much...
It works for me..
and yeah, I dont need to copy the files.. I just need to move them!

no need to use ls

for file in storage_directory/*

@ ghostdog74

Thanks so much!!!
Tried this one too.. it did work for me..

---------- Post updated at 11:29 AM ---------- Previous update was at 11:15 AM ----------

I have another Question:

I tried to run the following script: (I actually wanted to print out the second field in the text field.)

#!/usr/bin/ksh
set -x
readfile=/dir1/data.txt

cat $readfile | while read line
do
x = `echo $line|awk '{print $2}'`
echo $x
done

But, it shows the following error. It is unable to read the 'x' value.

# ./readData
+ readfile=/dir1/data.txt
+ cat /dir1/data.txt
+ read line
+ awk {print $2}
+ echo skhfkjshf 24343
+ x = 24343
./readData[7]: x: not found
+ echo

+ read line
+ awk {print $2}
+ echo jsdhfklhd 94890
+ x = 94890
./readData[7]: x: not found
+ echo

I have given all the permissions.. chmod 777 readData

Please help me out in solving this issue.

Thanks in advance.