perl script to transfer newly generated files by scp

Hi all,

  I have root directory on server 1 say A and having sub directory B now my application generates output files and put in sub directory B.

now i need to transfer these files from server1 to server2 by scp which is having same directory structure A and sub directory B
I have tried a lot but seems need ur guidance.

STAMP=$(perl -e '($ss, $mm, $hh, $DD, $MM, $YY) = localtime(time() - 3600);
printf "%04d%02d%02d%02d%02d", $YY + 1900, $MM + 1, $DD, $hh, $mm')
touch $STAMP /A/B
find /A/B -type f ! -newer /A/B -print -exec scp -r {} server2:/A/B/{} \; | tee -a ./output.txt

Try

find /A/B -type f ! -newer /A/B -print -exec scp -r {} server2:{} \;

If that doesn't work, try this as a way of debugging:

find /A/B -type f ! -newer /A/B -print -exec echo scp -r {} server2:{} \;
# tar cf - dirA | ssh remotehost " ( cd /some/path ; tar xf - ) "

Will pipe tar'd dirA and dirB if sub directory of dirA and untar it on remote host.
This is also handy if there is not enough space on disk to tar on localhost.

Regards
SRG