Retrieving file size in a remote server using SSH

Hi,

I have public and private keys and that's works fine for me. now I am sending files one by one on remote server and I want to check is file successfully delivered or not by comparing size of file on local machine and remote server using �stat -c%s'.

Below operations need to be done on remote server
1>change the directory where file is(known to me).
2>get the size of file
Using below command I able to get the file but �stat -c%s� retunes empty.

ssh -q -o ControlPath=/home/kraut/.ssh/cm_socket/%r@%h:%p_13929 uname@ip 'find /home/tmp/incoming/history/ -name user_HIST_151112_222225 -exec stat -c%s {} \;

please suggest me the solution on this or any other way to verifying successful file delivery on remote server.

Here you seemed to have missed the second single quote for find. Its not closed.

You can also try it this way:

ssh -q -o ControlPath=/home/kraut/.ssh/cm_socket/%r@%h:%p_13929 uname@ip 'ls -l /home/tmp/incoming/history/user_HIST_151112_222225' | awk '{print $5}'
1 Like

..thats working fine! thanks