Differences

This shows you the differences between the selected revisions of the page.

2008-07-20 2008-08-02
Restored revision 1207818575. Undoing revision 1216515196. (martin) (hidden) timestamp using realdate (martin)
Line 10: Line 10:
===== Downloading file to timestamped-filename ===== ===== Downloading file to timestamped-filename =====
 +
 +==== Using local-side date printing tool ====
 +
 +You can use any way to produce date string in desired format on command line, store that string to environment variable and use it in script. Although it is possible to [[http://www.robvanderwoude.com/datetiment.html|produce almost any date string]] using Windows commmand-line tools, easier is to use dedicated tool, such as [[http://www.huweb.hu/maques/realdate.htm|realdate]]:
 +
 +First create wrapper batch file to store the date string into environment variable:
 +
 +<code>
 +for /f %%T in ('realdate.com /f="CCYYMMDDhhmmss"') do (set TIMESTAMP=%%T)
 +winscp.com user@example.com /script=example.txt
 +</code>
 +
 +The script ''example.txt'' can use syntax ''%TIMESTAMP%'' to retrieve the date string in ''TIMESTAMP'' environment variable:
 +
 +<code winscp>
 +get /home/user/examplefile.txt *.%TIMESTAMP%.txt
 +exit
 +</code>
==== Using local-side scripting ==== ==== Using local-side scripting ====
Line 31: Line 49:
php -q download.php | winscp.com user@example.com /script="%temp%\download.tmp" php -q download.php | winscp.com user@example.com /script="%temp%\download.tmp"
</code> </code>
 +
==== Using remote-side scripting ==== ==== Using remote-side scripting ====

Last modified: by martin