Automating the static upload

By David
/
First published 14th February 2020 (Last Modified 9th January 2021)

I've automated some of my static upload process. This post is partially to provide a new post and partially to document/record the automatic part of the process. I created a batch script that generates a winscp script to upload files that changed, and will show the other differences (file adds and deletes) involved in the process. That script is:

@echo off
setlocal ENABLEDELAYEDEXPANSION
fossil extras >%temp%\fossil.out
for /f "delims=" %%a in (%temp%\fossil.out) do (
 fossil add %%a
)

set localdir=%cd%
set remotedir=/home/djvines/blog.tremlas.com

fossil status >%temp%\fossil.out
echo open blog.tremlas.com >%temp%\winscp.txt
for /f "delims=" %%a in (%temp%\fossil.out) do (
 set string=%%a
 for /f "tokens=1,2" %%c in ("!string!") do (
  set dz=%%d
  if "%%c"=="EDITED" echo put %localdir%\!dz:/=\! %remotedir%/%%d >>%temp%\winscp.txt
  if not "%%c"=="EDITED" echo !string!
 )
)
echo exit >>%temp%\winscp.txt
echo to run script execute:
echo "c:\Program Files (x86)\WinSCP\WinSCP.com" /script=%temp%\winscp.txt