SFTP issues

Hi All,
To transfer the files, from one server to another through SFTP, i am using below code in my script.

 
cur_dt=$1
echo "cd /inbox/" >> SFTP.txt  # folder of traget server
echo "mput /opt/myfile/inbox/*_${cur_dt}_*.* " >> SFTP.txt # to get files from /opt/myfile for given date and transfer to target
sftp -B SFTP.txt user@server >> FileTransfer.log

I have 3 problems here.

  1. The log file is contains all information produce by sftp command. For example, if one file is 149 MB in size, the log file will show following information about that file.
 
ABC.txt  | 8.8 MB | 1.5 MB/s | ETA: 00:01:35 |   5%
 ABC.txt  |  19 MB | 1.5 MB/s | ETA: 00:01:27 |  11%
 ABC.txt  |  28 MB | 1.5 MB/s | ETA: 00:01:21 |  18%
 ABC.txt  |  39 MB | 1.5 MB/s | ETA: 00:01:14 |  24%
 ABC.txt  |  47 MB | 1.5 MB/s | ETA: 00:01:08 |  31%
 ABC.txt  |  58 MB | 1.5 MB/s | ETA: 00:01:02 |  37%
 ABC.txt  |  67 MB | 1.5 MB/s | ETA: 00:00:55 |  44%
 ABC.txt  |  77 MB | 1.5 MB/s | ETA: 00:00:49 |  50%
 ABC.txt  |  86 MB | 1.5 MB/s | ETA: 00:00:42 |  57%
 ABC.txt  |  97 MB | 1.5 MB/s | ETA: 00:00:36 |  63%
 ABC.txt  | 106 MB | 1.5 MB/s | ETA: 00:00:29 |  70%
 ABC.txt  | 116 MB | 1.5 MB/s | ETA: 00:00:23 |  76%
 ABC.txt  | 125 MB | 1.5 MB/s | ETA: 00:00:16 |  83%
 ABC.txt  | 135 MB | 1.5 MB/s | ETA: 00:00:10 |  89%
 ABC.txt  | 144 MB | 1.5 MB/s | ETA: 00:00:03 |  96%
 ABC.txt  | 149 MB | 1.5 MB/s | ETA: 00:00:40 | 100%

I have total 96 files, and for each file, sftp command output as above in log file, which looks weired. Instead for each file, i need only

ABC.txt  | 149 MB | 1.5 MB/s | ETA: 00:00:40 | 100%
  1. As given above i am using mput /opt/myfile/inbox. But there are more than one inbox folder with number. ie inbox0, inbox1...inboxn which is dynamic.
    How to get all files from all inbox folder? I have tried using
/opt/myfile/inbox*/*_${cur_dt}_*.*  

But it did not work.
3. How can i verify, the total number of files in source and target are same after SFTP?

Can someone help me on this?
Regards,
ACE

I actually prefer scp over sftp for its compactness, but you might want to man sftp or sftp --help to get a better handle on your options; we cannot comment on what you have without you identifying your platform and SSH clients. The log is simply providing a progress meter by default. One of the options will allow you to disable this.

You would also do best to just rely on a subsequent ls of both your local and remote sets of files. Once you complete the upload ls your local set and then ls the remote via an SSH call.