I thought of these things because of a recent problem I had to solve:
- zipping via include (and exclude) list files like the WinZip & PkZip command line options
- maximum zip file size, e.g. include files until the size threshold is passed
- number of files to include in the zip
- For either limit by size or count, a way for us to define how the resulting zip names iterate via providing a name pattern string
My scenario is every evening we were zipping (with delete option) all PDFs in a folder and uploading the zip file to the FTP site. At times, because of volume, we were producing thousands of PDFs and the zip size could exceed 200MB, and then the FTP upload task would error on these larger zip files.
My workaround was a loop and C# script that touches the archive bit on 1000 PDFs at a time and zipping (and delete) those with the archive bit set ON, and iterating the zip filename with _001, _002, etc. 1000PDFs put the zips at about 26MB. It works perfectly, and uploads without fail now, but feels hacky and took a lot of time to figure out what resulted in a fairly simple job. This only works because of the delete option - if we weren't able to zip/delete, this process would be more involved.
(pseudo code)
- Job variable ZIPFILENAME: IMAGES_{DATEFORMAT(yyyyMMdd)}_{STRING(Right|000{LOOP(Iterations)}|3)}.ZIP
- List files task (*.PDF ), stop job if none
- LOOP
- C# script task sets archive bit ON for 1000 files, OFF for the rest
- Archive compress task archives (and deletes) those with archive bit ON using the job variable ZIPFILENAME
- ENDLOOP