Thanks Tony for suggestion!
I am still thinking if a button can run the batch file in the background 
and make the backup!

--Mohammad

On Sunday, April 7, 2019 at 8:42:36 AM UTC+4:30, TonyM wrote:
>
> Something I discovered for exporting batch files
>
>
>    - Place the batchfile in a tiddler of the type text/plain
>    - In windows install a printer of the Generic / Text Only type
>    - In Properties/Ports select file: to print to file
>
> Now when you come across your batch file tiddler 
>
>    - Optional copy the filename of the batch file to the clipboard
>    - Open the tiddler in a New window
>    - Select Print
>    - Select Generic / Text Only Printer
>    - The save file dialogue opens, paste or type the filename eg test.bat 
>    test.cmd
>    - Ok to save the file - the HTML extension will not be added and it is 
>    a valid batch file ready to run.
>
> Regards
> Tony
>
> On Sunday, April 7, 2019 at 6:22:46 AM UTC+10, Mohammad wrote:
>>
>> Good to share! If you work on Windows the below batch file can be used to 
>> create
>> backups from you Tiddlywiki files using robocopy!
>>
>> save this is .bat or .cmd file like mybackup.cmd
>> set the source and destination folder and it works!
>>
>> I used for example 
>>
>> source=G:\TW\TW-Yazd
>> dest =G:\TW\MyArchive\TW-Yazd 
>>
>>
>> @echo off
>> cls
>>
>> :: Set Source folder, from which you copy files/folders
>> set source=G:\TW\TW-Yazd
>> :: Set Destination folder, from which you copy files/folders
>> set dest=G:\TW\MyArchive\TW-Yazd
>> :: Set Archive folder (keeps zipped files) 
>> set archive=%dest%\backups
>>
>> :: Sets specific copy instructions
>> :: See readme for more details
>> SET what=/COPY:DT /E
>>
>>
>> :: See readme for more details
>> :: Log file specifications
>> SET _options=/LOG:%dest%\backup.log
>>
>>
>> :: Generate a yyyy.mm.dd-hh.mm.ss extension
>> set 
>> _dateExt=%date:~-4,4%.%date:~-7,2%.%date:~-10,2%-%time:~0,2%.%time:~3,2%.%time:~6,2%
>> :: add leading zeros
>> set _dateExt=%_dateExt: =0%
>>
>> :: Starts ROBOCOPY
>> ROBOCOPY "%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
>> :: 
>> https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy
>>
>>
>> You can turn off zip or plane backup or keep both of them as I used above!
>> Note: for zip, it uses 7zip if you have other programs replace the below 
>> line
>> "C:\Program Files\7-Zip\7z.exe"
>>
>>
>> --Mohammad
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/84d343d3-6cad-4af2-aa0d-3638a18ce5f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to