SFTP - Get size of file on remote server

Hi,

I have a requirement where I need to do SFTP connection to remote server, get the size of the file on remote server and depending on the size, i need to get the file onto local server.
Is there any command in SFTP to get the size of the file. I found one in FTP but not in SFTP

ls -l file will give you the size but you will need to parse the output. if your syncing files check out the rsync utility.

Actually i was looking to get those files from remote machine which are already written ( written is complete ). I dont want to pull incomplete files or files which are being written on remote machine by another process at the time of "get" execution on that remote machine.

Is there a way i can do this? I didn't find the right command in SFTP to do this.