sftp output to file.

Hi friends,
How to log the STFP put command output to a file, please give me a solution to solve this problem.

This is the program..

Main File : cp_ftp_file.

send_file()
{
 sftp -b sftp_cmd_file_temp.txt ingrammicro@secure.streamliteinc.com 
}
echo 'Manifest FTP started....'
send_file
grep -ic "100" /app/csw/bin/ftp_output_log_IMP573 > /app/csw/bin/ftp_temp_IMP573

Batch File :sftp_cmd_file_temp.txt

progress
cd incoming/
put TestFiletest 
quit

OutPut:

Manifest FTP started....
sftp> progress
Progress meter enabled
sftp> cd incoming/
sftp> put TestFiletest 
Uploading TestFiletest to /Home/ingrammicro/incoming/TestFiletest
TestFiletest                              100%   74     0.1KB/s   00:00   
sftp> quit

Here the output is created manually by running the program in the unix prompt, i need to log this output to the file.

sftp ... > /path/to/my.log 2>&1

Hi frank_rizzo,
Thanks for your reply...

Manually output:

Manifest FTP started....
sftp> progress
Progress meter enabled
sftp> cd incoming/
sftp> put TestFiletest
Uploading TestFiletest to /Home/ingrammicro/incoming/TestFiletest
TestFiletest                                                                       100% 74 0.1KB/s 00:00
sftp> quit

Log file Output :

sftp> progress
Progress meter enabled
sftp> cd incoming/
sftp> put TestFiletest  
Uploading TestFiletest to /Home/ingrammicro/incoming/TestFiletest
sftp> quit

As you can see that second get command output line(which includes some statistics.. ie.. TestFiletest 100% 74 0.1KB/s 00:00) is missing.

Any way to include that statistics line into my log ?

your executing in batch mode so I believe the progress meter is disabled.

Hi frank_rizzo
I enabled the progress meter also, you clearly seen that line
(sftp> progress
Progress meter enabled)
in the output...
Any other way to include that statistics line into my log ?

no -b batch mode disables this by design.

Hi frank_rizzo
how to over come this problem..

Can you give try to "script" command?
script before running sftp, and exit after running sftp.

The option is turned off when batch is used. You could edit the source code and rebuild SSH if you really want it.