save application folder in a zip

Features wanted...
Post Reply
calude
Posts: 355
Joined: 13 Aug 2008 10:16
Location: Switzerland
Contact:

save application folder in a zip

Post 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

yuyu
Posts: 114
Joined: 19 Jun 2018 12:40

Re: save application folder in a zip

Post 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.

calude
Posts: 355
Joined: 13 Aug 2008 10:16
Location: Switzerland
Contact:

Re: save application folder in a zip

Post 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
Attachments
2021-07-14_174529.png
2021-07-14_174529.png (9.76 KiB) Viewed 1118 times
Last edited by calude on 15 Jul 2021 17:15, edited 1 time in total.

yuyu
Posts: 114
Joined: 19 Jun 2018 12:40

Re: save application folder in a zip

Post 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 :(

klownboy
Posts: 4139
Joined: 28 Feb 2012 19:27

Re: save application folder in a zip

Post 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";
Last edited by klownboy on 14 Jul 2021 22:18, edited 1 time in total.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

highend
Posts: 13309
Joined: 06 Feb 2011 00:33

Re: save application folder in a zip

Post 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)...
One of my scripts helped you out? Please donate via Paypal

klownboy
Posts: 4139
Joined: 28 Feb 2012 19:27

Re: save application folder in a zip

Post by klownboy »

Oops sorry, thanks highend. I'll correct my post so no one is lead down a merry path.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

yuyu
Posts: 114
Joined: 19 Jun 2018 12:40

Re: save application folder in a zip

Post by yuyu »

Thanks highend for help with those quotations. Switched to 7z.

klownboy
Posts: 4139
Joined: 28 Feb 2012 19:27

Re: save application folder in a zip

Post 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;
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

highend
Posts: 13309
Joined: 06 Feb 2011 00:33

Re: save application folder in a zip

Post by highend »

or runret() with a flag of 2 so you have some error checking as well
One of my scripts helped you out? Please donate via Paypal

calude
Posts: 355
Joined: 13 Aug 2008 10:16
Location: Switzerland
Contact:

Re: save application folder in a zip

Post by calude »

A big thank you to all

Claude

Post Reply