Actually I am using TW on Node.js on a Windows machine and I like to have a backup of the tiddlers I change!
Many thanks Mario!I will have a look and inform you how it works for me!
This plugin causes TiddlyWiki to continuously download (as a JSON file) the contents of any tiddler that is manually changed by any of several means:
Where appropriate, separate 'before' and 'after' files are downloaded. Configured correctly, the browser will download the files silently in the background, and they can be used as a backup in case of accidental data loss.
Mohammand,For your exploration.On Windows 10,
- I sometimes simply zip a whole wikifolder for backup before a major event. This could be automated if desired.
- If the folder was connected to a Dropbox (or version controled sync) sync, dropbox would maintain multiple versions of each file.
- A Button to export recently changed or the whole wiki to a file would be a way to backup a folder based wiki to file.
- There is a lot of room here for new solutions and worth exploring.
- This button could be triggered in startup actions to backup on load, or with a close wiki button.
@echo offcls
:: Set Source folder, from which you copy files/foldersset source=G:\TW\TW-Yazd:: Set Destination folder, from which you copy files/foldersset dest=G:\TW\MyArchive\TW-Yazd:: Set Archive folder (keeps zipped files) set archive=%dest%\backups
:: Sets specific copy instructions:: See readme for more detailsSET what=/COPY:DT /E
:: See readme for more details:: Log file specificationsSET _options=/LOG:%dest%\backup.log
:: Generate a yyyy.mm.dd-hh.mm.ss extensionset _dateExt=%date:~-4,4%.%date:~-7,2%.%date:~-10,2%-%time:~0,2%.%time:~3,2%.%time:~6,2%:: add leading zerosset _dateExt=%_dateExt: =0%
:: Starts ROBOCOPYROBOCOPY "%source%" "%dest%\%_dateExt%" %what% %_options%
:: zips up the backup folder"C:\Program Files\7-Zip\7z.exe" a -t7z "%archive%\%_dateExt%.7z" "%source%\*" -r > null
::REF
Good to share! If you work on Windows the below batch file can be used to createbackups from you Tiddlywiki files using robocopy!
save this is .bat or .cmd file like mybackup.cmdset the source and destination folder and it works!
:: Running the script will first Robocopy any files which don't already exist in the destination,:: then use xcopy to create version-incremented copies of any files which do exist in the destination.:: Mohammad Rahmani:: Github: https://github.com/kookma
:: Rev 0.9:: Apr 8th, 2019
@echo offcls
:: Source and destination paths. Do not include a trailing backslashset SourceFolder="G:\Test-Robocopy\my source"set DestinationFolder="G:\Test-Robocopy\my dest" :: ----------------------------------------------------------------------------------------------------- :: Remove double and single qoutes if any set source=%SourceFolder:"=% set source=%source:'=% set dest=%DestinationFolder:"=% set dest=%dest:'=% setlocal EnableDelayedExpansion :: Copy any file, folder not existed in the destinationrobocopy "%source%" "%dest%" /XC /XN /XO /R:3 /W:3 /E /XX :: List all files existed in destination, but there is a difference between each file and its :: sourcefor /F "tokens=*" %%G in ('robocopy "%source%" "%dest%" /XX /L /NDL /NS /NC /NJH /NJS /E') do ( call :_process "%%G")goto :eof :: The process subroutine here does the below tasks:: a. create a new copy of destination file prefixed with _vxxx, where xxx: 001 ~ 999 (version-incremented copies ):: so this only keep 1000 revisions and cannot work for more revisions:: b. copy the source file and overwrite the destination. So, destination is always equal to source:_processset counter=0set version=000set source_path=%~dp1set file=%~n1set ext=%~x1 :: Create the destionation path for the existed file. by replacing the:: source path with destination path. (search and replace)set dest_path=!source_path:%source%=%dest%!
:: Check to see what is the last version number to create the next version number :_loopif exist "%dest_path%%file%_v%version%%ext%" ( set /A counter+=1 :: create a number with leading zeros like 001 ~ 999 set version=000!counter! set version=!version:~-3! goto :_loop)
:: Increment the version number of the file in destination which differes from its identical one in sourceecho F|xcopy "%dest_path%%file%%ext%" "%dest_path%%file%_v%version%%ext%" /C /H /R /Z /Q:: Copy from source and overwrite the respective file in destination: source = destinationecho F|xcopy %1 "%dest_path%\%file%%ext%" /C /H /R /Z /Y /Qgoto :eof
endlocal