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
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?
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