Page 1 of 1

save application folder in a zip

Posted: 14 Jul 2021 13:43
by calude
Sometimes I close my laptop a little brutally fast, and as a by-product I got UDC and other *.DAT files reset to their "Default" state.
probably they where being saved by XY while the laptop was closing everything.
I unchecked "save on exit". And all is good. But While trying to recover from those .dat resets I found out that, although I had backups, they where old and not so many.
to be more on the safe side I would like to have a script that would backup the application data folder in a zip sequentially named by the date.

Thanks

Claude

Re: save application folder in a zip

Posted: 14 Jul 2021 16:56
by yuyu
Something like this:

Code: Select all

$BackupPath = "[YOUR PATH]\XY_<xyver>_<date ddmmyy_hhnnss>.zip";
	status "Backup in progress...", "", "progress";
	zip_add($BackupPath, <xydata>);
	status "Backup to ""$BackupPath"" done", "", "ready";
Change [YOUR PATH] to your needs.

Re: save application folder in a zip

Posted: 14 Jul 2021 17:56
by calude
yuyu thanks a lot

but when I launch the script it complains that some characters are not allowed to be compressed.


if I use 7zip to zip the same folder no complain?!?

Claude

Re: save application folder in a zip

Posted: 14 Jul 2021 18:36
by yuyu
The problem is not in the script itself. It seems that native Windows zip utility somehow does not like § symbols. I don't use Session Manager (and that problem characters are generated likely by it). Tried on my system. It compresses without complaints but breaks those symbols in the archive and after decompressing.
§2§_ >>> _2__
Cannot offer the solution yet :(

Re: save application folder in a zip

Posted: 14 Jul 2021 21:58
by klownboy
It seems you have 7-Zip installed. You could try substituting 7z for zip_add. Something along these lines.

Code: Select all

 $BackupPath = "Your Destinaiton Path\XY_<xyver>_<date ddmmyy_hhnnss>.zip";
 status "Backup in progress...", "", "progress";
 run """Your Path to 7z\7z.exe"" a ""$BackupPath"" ""<xydata>""";
 status "Backup to ""$BackupPath"" done", "", "ready";

Re: save application folder in a zip

Posted: 14 Jul 2021 22:14
by highend

Code: Select all

run """Your Path to 7z\7z.exe"" a ""$BackupPath"" ""<xydata>""";
Otherwise you'll run into problems if any of your paths contains space(s)...

Re: save application folder in a zip

Posted: 14 Jul 2021 22:17
by klownboy
Oops sorry, thanks highend. I'll correct my post so no one is lead down a merry path.

Re: save application folder in a zip

Posted: 14 Jul 2021 22:50
by yuyu
Thanks highend for help with those quotations. Switched to 7z.

Re: save application folder in a zip

Posted: 15 Jul 2021 14:29
by klownboy
To make it more seemless (i.e., without the 7z box flashing on the screen) use "0" for SC run show parameter.
run """Your Path to 7z\7z.exe"" a ""$BackupPath"" ""<xydata>""",,,0;

Re: save application folder in a zip

Posted: 15 Jul 2021 14:45
by highend
or runret() with a flag of 2 so you have some error checking as well

Re: save application folder in a zip

Posted: 15 Jul 2021 17:09
by calude
A big thank you to all

Claude