Differences

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

2009-02-20 2009-02-20
typo commmand (martin) full example for upoading file, use open command instead of opening from command line (martin)
Line 3: Line 3:
===== [[upload]] Uploading single file ===== ===== [[upload]] Uploading single file =====
-Upload single file involves so little commands that it it enough to provide them on command line, saving writing a script file:+Upload single file involves so little commands that it is enough to provide them on command line, saving writing a script file:
<code> <code>
-winscp.com user@example.com /command "put examplefile.txt /home/user/" "exit"+winscp.com /command "option batch abort" "open user@example.com" "put examplefile.txt /home/user/" "exit"
</code> </code>
 +
 +However you may want to use a script file anyway, so you can later expand it:
 +
 +<code winscp>
 +option batch abort
 +open user@example.com
 +put examplefile.txt /home/user/
 +exit
 +</code>
 +
 +To run the script use following command (proving you have saved the script to file ''example.txt''):
 +
 +<code>
 +winscp.com /script=example.txt
 +</code>
 +
===== Downloading file to timestamped-filename ===== ===== Downloading file to timestamped-filename =====
Line 19: Line 35:
<code> <code>
for /f %%T in ('realdate.com /f="CCYYMMDDhhmmss"') do (set TIMESTAMP=%%T) for /f %%T in ('realdate.com /f="CCYYMMDDhhmmss"') do (set TIMESTAMP=%%T)
-winscp.com user@example.com /script=example.txt+winscp.com /script=example.txt
</code> </code>
Line 25: Line 41:
<code winscp> <code winscp>
 +open session
get /home/user/examplefile.txt *.%TIMESTAMP%.txt get /home/user/examplefile.txt *.%TIMESTAMP%.txt
exit exit
Line 34: Line 51:
<code php> <code php>
 +open session
get /home/user/examplefile.txt *.<?=date("YmdHis")?>.txt get /home/user/examplefile.txt *.<?=date("YmdHis")?>.txt
exit exit
Line 41: Line 59:
<code winscp> <code winscp>
 +open session
get /home/user/examplefile.txt *.20060605090825.txt get /home/user/examplefile.txt *.20060605090825.txt
exit exit
Line 47: Line 66:
Now pass the generated script file as input to WinSCP: Now pass the generated script file as input to WinSCP:
<code> <code>
-php -q download.php | winscp.com user@example.com /script="%temp%\download.tmp"+php -q download.php | winscp.com /script="%temp%\download.tmp"
</code> </code>
Line 55: Line 74:
<code winscp> <code winscp>
 +open session
# Make copy of the remote file to temporary timestamped file. # Make copy of the remote file to temporary timestamped file.
# Also add unique extension to easily find the file in the temporary directory. # Also add unique extension to easily find the file in the temporary directory.
Line 71: Line 91:
<code winscp> <code winscp>
 +open session
# Make copy of the most recent file using remote command to new name # Make copy of the most recent file using remote command to new name
# with unique extension to easily find the file in the temporary directory. # with unique extension to easily find the file in the temporary directory.
Line 83: Line 104:
</code> </code>
-===== [[local_move]] Moving local files to different location after upload =====+===== [[local_move]] Moving local files to different location after successful upload =====
WinSCP does not support move command for local files. Instead you can combine WinSCP script with batch file: WinSCP does not support move command for local files. Instead you can combine WinSCP script with batch file:

Last modified: by martin