Automating the static upload (Feb 2020)

By David
14th February 2020
0

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