Batch file to move video files and retain sub-directories

I have just purchased my first ever Apple computer - and am therefore new to UNIX also.

I would like to create a simple "batch file" (apologies if this is the wrong terminology) to do the following:

When I plug my camera into the MAC it automatically downloads photos and videos into a new sub-directory inside the "Pictures" folder, the new folder name is the date on which the photos were taken.
eg,
Pictures\2011-04-28

The problem is it puts both photos (jpg) and videos (avi) into this folder. I want to separate the photos from the videos.

I need a script which will move the videos to a new folder inside "Movies" but retains the date based sub-directory name.
eg,
Movies\2011-04-28

I hope this makes sense!

Thanks in advance.

A shell script can do this for you. It needs to find all the avi files in Pictures, find all the target date dirs supporting those files, make any missing Movies dirs, and move the files.

#!/bin/ksh
 
cd Pictures
 
for f in */*.avi
do
 if [ "$f" = "*/*.avi"
 then
  break
 fi
 
 if [ ! -d ../Movies/"${f%/*}" ]
 then
  mkdir ../Movies/"${f%/*}"
 fi
 
 mv "$f" ../Movies/"$f"
done

You must tune this up for the actual absolute path of ?\Pictures\. I am assuming the slashes reverse in the shell world, not being a MAC guy.