Copying files from one server to other.

Any one advice here-

need to copy some files from one server to other server thru shell programming.

Not know your platform (OS / version etc...) architecture (connect only by ssh?) and utilities installed, it will be difficult to answer...
You could use
ftp
rcp
scp

please give examples. any input/output?

Linus server

two server A and B

we are at server B- location /name/

need to copy files from A to B which comes under

find $mainPath -name 'Book*' -mtime -10

That would be easy I suppose with rcp (or scp? dont know...) but for that you would need to have configured a .rhosts file in your $HOME on both servers...

scp -p sam@A:/name/Book* /name/
works fine
Q1- i need to merge pwd option in same line as well.
Q2- above command fails if i can use
scp sam@A:\`find /name/ -name 'Book*' -mtime -10` /name/

Why dont you use a loop (for / while)?
like

for i in `find /name/ -name 'Book*' -mtime -10` 
do
 scp...
done

But how it find files on server B when u r at A server.

Also let me know how can i use predefine password in scp.

Do a search on this forum (up right...) on how to exchange pubilc/private keys for ssh without password

I thought you wanted to copy files from server A to B? ( from the code you gave...)