How to store files/directories in different directories!!

Hi legends,

I am writing a script, in that my requirement is, if all the fill types stored in one directory from that we need to separate different different directories based on the file types.

for example in a directory(anish). 5 different types files
1- directory
2- .txt files
2- .sh files

like that and my requirement is the (1- directory is moved to one new directory(dir) which we are given in the script)

and (2 .txt files are moved to another new directory(test) which we are given in the script)

and ( 2 .sh files are moved to another new directory(bash) which we are given in the scrip)

finally the directory anish should be empty..using bash script.how it is possible !!

for this process i need to maintain log also , please guide me !!!
__________________
With Regards
Anish kumar.V

This sounds very much like homework. We have a special homework forum.

PS: if you

mv directory  newdirectory

all the files in 'directory' are still in the newdirectory. This requirement is very unlikely except in school assignments by teachers who are not programmers.

In short it makes no sense to put directories into separate directories for just directories.
What do you do with sub-directories?