Aszip Question

Hello,

I am trying to compress files in the PLC using AsZip.
When there are files a, b, c, d, and e in the same folder, I want to compress only a, b, and c files. However, I couldn’t find an example for this in the AsZip documentation.

I tried the following method, but only one file gets compressed.
How can I compress multiple specific files?

CASE ZipStep OF
	1:
		zipArchive_0(enable := TRUE, pArchiveDevice := ADR('LOCALDISK'), pArchiveFile := ADR('Test2.tar'), pSrcDevice := ADR('LOCALDISK'), pSrcFile := ADR(OldFileList[ZipNo]), pOptions := ADR('/COMPRESSION_LEVEL=6'));
		
		IF zipArchive_0.status = 0 THEN
			ZipNo := ZipNo + 1;
		END_IF
		IF ZipNo >= 10 THEN
			ZipStep := 2;
		END_IF
END_CASE

So we meet again :slight_smile:

I haven’t used it myself so far, but have you tried what happens if you call this FUB for each file, leaving the zip name the same? Will it add the file to the existing ZIP or will it override the zip leaving you with only one file in it at all times?

1 Like

Thank you for your answer.

I tried running the function with different file names, but the ZIP file with only one file was being overwritten.

Then you need to specify the whole folder and zip that one.
But I would like to refer to my last reply on your other topic, questioning the 20k files and maybe that way you don’t even need any of this zipping :slight_smile:

1 Like

Thanks.

customer needs all log files. it’s battery’s logs…

I solved it by moving the log files into a single folder, compressing them, and then deleting the files and the folder.
Thank you so much!

1 Like