Hi,
I think you should create a function <function copydir($olddir, $newdir)>, which will open the dir you are trying to copy ($olddir), then creates the new directory at the new location ($newdir)and gets all the filenames from the old location.
For each file entry it will check wether it is a directory, file or something else. If it is a file, it will copy it. If it is a directory, it will call itself, but with the new directory to read ($olddir = $dir."/".$subdir) and to write ($newdir = $ndir."/".subdir).
Hope this helps?
Of course: Have a read in the manual for handling files & directories..