Question

How do I get the last time stamp of a .txt file from WinSCP when using .txt and .bat scripting?

Was it helpful?

Solution

Well, you should better state, what do you want to do with the timestamp. You might get better answer then.

Anyway:

  1. WinSCP has the stat command:

    stat /home/martin/index.html
    

    Outputs something like:

    -rwxr--r--   0                       20480 Jan  5 14:09:33 2009 index.html
    

    You can redirect the output of the WinSCP script to a file and parse.

    Or even better use XML logging and parse the XML log.

  2. Easier solution may be to make use of WinSCP .NET assembly method Session.GetFileInfo.

    An additional example (to those linked in the method documentation) is here:
    https://winscp.net/eng/docs/scriptcommand_stat#net

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top