<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://dwarffortresswiki.org/index.php?action=history&amp;feed=atom&amp;title=User%3AKuroneko%2FSync</id>
	<title>User:Kuroneko/Sync - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://dwarffortresswiki.org/index.php?action=history&amp;feed=atom&amp;title=User%3AKuroneko%2FSync"/>
	<link rel="alternate" type="text/html" href="https://dwarffortresswiki.org/index.php?title=User:Kuroneko/Sync&amp;action=history"/>
	<updated>2026-05-24T14:23:06Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.11</generator>
	<entry>
		<id>https://dwarffortresswiki.org/index.php?title=User:Kuroneko/Sync&amp;diff=97837&amp;oldid=prev</id>
		<title>Kuroneko: Created page with 'This is a small batch script that would be stored in the game directory. It allows you to sync the local DF folder with a remote DF folder. The purpose is to transfer saved games…'</title>
		<link rel="alternate" type="text/html" href="https://dwarffortresswiki.org/index.php?title=User:Kuroneko/Sync&amp;diff=97837&amp;oldid=prev"/>
		<updated>2010-04-23T12:33:25Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;#039;This is a small batch script that would be stored in the game directory. It allows you to sync the local DF folder with a remote DF folder. The purpose is to transfer saved games…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This is a small batch script that would be stored in the game directory. It allows you to sync the local DF folder with a remote DF folder. The purpose is to transfer saved games to other machines. Since I play DF on three machines (desktop, laptop, work desktop) it became important to keep them all the same. It will only attempt to transfer new information, and won't overwrite otherwise. It will not automatically backup/restore the seasonal auto-backup saves, only the main region folders. You will also need GetTime.cmd from [http://ss64.com/nt/syntax.html] and either put it in your system32 dir or the dwarf fortress folder. To acctually use the script, you'll need to send two parameters to it. The first will be the location of the dwarf fortress folder on the local machine and the second is the folder on the remote machine. Whenever it pulls or pushes information from that remote source, will will log the name of the machine and the time at which is started and finished. The script will automatically display the most recent entry for you so that you know what the status is.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;display:block;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;collapsible collapsed infobox&amp;quot; style=&amp;quot;border: 1px solid #72A329; font-size: 90%; margin: 0; padding: 2px; text-align: left; display:table; width:100%; max-width:inherit; background-color:#f5ffee; border-top-left-radius:8px; -moz-border-radius-topleft:8px; -webkit-border-top-left-radius:8px;&amp;quot;&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot; style=&amp;quot;border: 1px solid #72A329; font-weight:bold; background-color: #bd8; padding-left: 1em; padding-right: 1em; width:100%; display:table-cell; border-top-left-radius:4px;-moz-border-radius-topleft:4px; -webkit-border-top-left-radius:4px;&amp;quot; | Code&lt;br /&gt;
|- style=&amp;quot;text-align: left; display:table-cell; max-width:inherit&amp;quot;&lt;br /&gt;
| &amp;lt;div style=&amp;quot;overflow:auto; max-height:800px;&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-family: monospace; font-size:1.25em; white-space:pre;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
@echo off&lt;br /&gt;
&lt;br /&gt;
title Dwarf Fortress&lt;br /&gt;
&lt;br /&gt;
set localdir=%~1&lt;br /&gt;
set remotedir=%~2&lt;br /&gt;
&lt;br /&gt;
net use &amp;quot;%remotedir%&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cls&lt;br /&gt;
&lt;br /&gt;
if not exist &amp;quot;%remotedir%&amp;quot; goto error&lt;br /&gt;
&lt;br /&gt;
:menu &lt;br /&gt;
&lt;br /&gt;
if &amp;quot;noremote&amp;quot;==&amp;quot;1&amp;quot; goto skipstatus&lt;br /&gt;
&lt;br /&gt;
echo Last recorded command to source:&lt;br /&gt;
setLocal EnableDelayedExpansion&lt;br /&gt;
for /f &amp;quot;tokens=* delims= &amp;quot; %%a in (%remotedir%\dfortress.log) do (&lt;br /&gt;
set var=%%a&lt;br /&gt;
)&lt;br /&gt;
echo !var!&lt;br /&gt;
endlocal&lt;br /&gt;
echo.&lt;br /&gt;
&lt;br /&gt;
:skipstatus&lt;br /&gt;
&lt;br /&gt;
echo 1) Pull, Launch, Push&lt;br /&gt;
echo 2) Launch&lt;br /&gt;
echo 3) Pull&lt;br /&gt;
echo 4) Push&lt;br /&gt;
echo 5) Exit&lt;br /&gt;
&lt;br /&gt;
choice /C:12345 /N ?:&lt;br /&gt;
&lt;br /&gt;
echo.&lt;br /&gt;
&lt;br /&gt;
if %errorlevel%==1 goto full&lt;br /&gt;
if %errorlevel%==2 goto launch&lt;br /&gt;
if %errorlevel%==3 goto pull&lt;br /&gt;
if %errorlevel%==4 goto push&lt;br /&gt;
if %errorlevel%==5 goto exit&lt;br /&gt;
&lt;br /&gt;
cls&lt;br /&gt;
echo Invalid Choice&lt;br /&gt;
echo.&lt;br /&gt;
goto menu&lt;br /&gt;
::&lt;br /&gt;
:: Full Cycle&lt;br /&gt;
::&lt;br /&gt;
:full&lt;br /&gt;
&lt;br /&gt;
if &amp;quot;noremote&amp;quot;==&amp;quot;1&amp;quot; goto error&lt;br /&gt;
&lt;br /&gt;
set full=1&lt;br /&gt;
&lt;br /&gt;
echo Running full cycle...&lt;br /&gt;
&lt;br /&gt;
call :pull&lt;br /&gt;
call :launch&lt;br /&gt;
call :push&lt;br /&gt;
&lt;br /&gt;
goto exit&lt;br /&gt;
&lt;br /&gt;
::&lt;br /&gt;
:: Pull&lt;br /&gt;
::&lt;br /&gt;
:pull&lt;br /&gt;
&lt;br /&gt;
if &amp;quot;noremote&amp;quot;==&amp;quot;1&amp;quot; goto error&lt;br /&gt;
&lt;br /&gt;
title Dwarf Fortress - Pulling&lt;br /&gt;
&lt;br /&gt;
echo Bringing up changes from server...&lt;br /&gt;
&lt;br /&gt;
call gettime&lt;br /&gt;
&lt;br /&gt;
echo %_time% : %computername% - Pull - Start &amp;gt;&amp;gt; &amp;quot;%remotedir%\dfortress.log&amp;quot;&lt;br /&gt;
&lt;br /&gt;
robocopy &amp;quot;%remotedir%&amp;quot; &amp;quot;%localdir%&amp;quot; * /Z /E /PURGE /XF gamelog.txt *.log /XD *-spr-* *-sum-* *-aut-* *-win-* &amp;gt; &amp;quot;%localdir%\dfortress-pull.log&amp;quot;&lt;br /&gt;
&lt;br /&gt;
call gettime&lt;br /&gt;
&lt;br /&gt;
echo %_time% : %computername% - Pull - End &amp;gt;&amp;gt; &amp;quot;%remotedir%\dfortress.log&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo Done.&lt;br /&gt;
&lt;br /&gt;
if &amp;quot;%full%&amp;quot;==&amp;quot;1&amp;quot; goto :eof&lt;br /&gt;
&lt;br /&gt;
choice /C:yn /N Do you want to play? [y/n]:&lt;br /&gt;
&lt;br /&gt;
if %errorlevel%==1 goto launch&lt;br /&gt;
if %errorlevel%==2 goto exit&lt;br /&gt;
&lt;br /&gt;
::&lt;br /&gt;
:: Launch&lt;br /&gt;
::&lt;br /&gt;
:launch&lt;br /&gt;
&lt;br /&gt;
title Dwarf Fortress - Running&lt;br /&gt;
&lt;br /&gt;
echo Launching Dwarf Fortress...&lt;br /&gt;
&lt;br /&gt;
cd /d &amp;quot;%localdir%&amp;quot;&lt;br /&gt;
&lt;br /&gt;
start /wait dwarfort.exe&lt;br /&gt;
&lt;br /&gt;
if &amp;quot;%full%&amp;quot;==&amp;quot;1&amp;quot; goto :eof&lt;br /&gt;
&lt;br /&gt;
choice /C:yn /N Do you want to push your changes? [y/n]:&lt;br /&gt;
&lt;br /&gt;
if %errorlevel%==1 goto push&lt;br /&gt;
if %errorlevel%==2 goto exit&lt;br /&gt;
&lt;br /&gt;
::&lt;br /&gt;
:: Push&lt;br /&gt;
::&lt;br /&gt;
:push&lt;br /&gt;
&lt;br /&gt;
if &amp;quot;noremote&amp;quot;==&amp;quot;1&amp;quot; goto error&lt;br /&gt;
&lt;br /&gt;
title Dwarf Fortress - Pushing&lt;br /&gt;
&lt;br /&gt;
echo Pushing changes back to server...&lt;br /&gt;
&lt;br /&gt;
call gettime&lt;br /&gt;
&lt;br /&gt;
echo %_time% : %computername% - Push - Start &amp;gt;&amp;gt; &amp;quot;%remotedir%\dfortress.log&amp;quot;&lt;br /&gt;
&lt;br /&gt;
robocopy &amp;quot;%localdir%&amp;quot; &amp;quot;%remotedir%&amp;quot; * /Z /E /PURGE /XF gamelog.txt *.log /XD *-spr-* *-sum-* *-aut-* *-win-* &amp;gt; &amp;quot;%localdir%\dfortress-push.log&amp;quot;&lt;br /&gt;
&lt;br /&gt;
call gettime&lt;br /&gt;
&lt;br /&gt;
echo %_time% : %computername% - Push - End &amp;gt;&amp;gt; &amp;quot;%remotedir%\dfortress.log&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo Done.&lt;br /&gt;
&lt;br /&gt;
if &amp;quot;%full%&amp;quot;==&amp;quot;1&amp;quot; goto :eof&lt;br /&gt;
&lt;br /&gt;
goto exit&lt;br /&gt;
&lt;br /&gt;
::&lt;br /&gt;
:: Exit&lt;br /&gt;
::&lt;br /&gt;
:exit&lt;br /&gt;
&lt;br /&gt;
echo Goodbye&lt;br /&gt;
&lt;br /&gt;
exit&lt;br /&gt;
&lt;br /&gt;
::&lt;br /&gt;
:error&lt;br /&gt;
::&lt;br /&gt;
&lt;br /&gt;
echo The following remote directory is not available, you will only be able to 'Launch'&lt;br /&gt;
echo %remote%&lt;br /&gt;
set noremote=1&lt;br /&gt;
&lt;br /&gt;
pause&lt;br /&gt;
&lt;br /&gt;
goto menu&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kuroneko</name></author>
	</entry>
</feed>