Need to copy latest file using SFTP

Hi All,
In my unix server, I have the following files:

h1.txt
h2.txt
h3.txt

and through SFTP i need to copy only the latest file to another unix server.

Can you please let me know what command i need to use.

Thanks in Advance,

Hi , try this

#!/bin/sh

latest_file=`ls -ltr | tail -1 | awk '{print $9}'`
scp $latest_file user@$SERVER_NAME:$TARGET_PATH

Hema,
If you want to transfer only latest/updated files from one Unix server to another. I would suggest you to use rsync.

-Nithin.