Search code examples
windowsbatch-filecommand-linesftppsftp

Timestamp and Increased levels of verbose logging using PSFTP


I am needing to add verbose logging to an FTP to another system as they claim they are not always receiving a file sent.

I am calling psftp.exe using a script and trying the -v option for verbose logging which works, I also want to add a timestamp to either the log file or inside the log.

I also noticed using -v 3 and -v 4 reveals more detailed logging. I wish to output this to a file.

Here is my putty call:

\\myserver\mytable\psftp.exe mylogin@myipaddress -pw mypassword -b C:\Users\pervasive\Desktop\mytable\mysftpscript.sftp  -v 2> \\myserver\mytable\mylog.txt

Solution

  • To log a complete verbose (-v) output of psftp to a file use:

    psftp [email protected] -pw password -v > psftp.log 2>&1
    

    See also Redirect Windows cmd stdout and stderr to a single file.


    There's no way to make psftp produce timestamps.


    Note that there are no verbosity levels in psftp. There's no -v 3 or -v 4.