Sort Job PDFs into smaller zips less than 256 MB

Post Reply
estaub
Newbie
Posts: 9
Joined: Mon Oct 07, 2019 12:00 am

Sort Job PDFs into smaller zips less than 256 MB

Post by estaub »

I receive folders of many (up to thousands) PDFs that need sorted into 256MB or less zip archives.
I'm not sure how to split or sort into 256MB groups.

I started by submitting the folder as a job, upgrouping the job....but not sure where to go next. A hold based on some criteria. a sort based on some regex? Any ideas or direction?

Thank you,
freddyp
Advanced member
Posts: 1022
Joined: Thu Feb 09, 2012 3:53 pm

Re: Sort Job PDFs into smaller zips less than 256 MB

Post by freddyp »

Do the ZIP files have to be smaller than 256MB or do you want to zip a group of files that is smaller than 256 MB?

I guess it is the first case. That is hard without scripting because you cannot predict how big the result will be. Do you have to collect 350MB worth of data or can you collect 400MB? Files that already have some sort of compression obviously compress less well than other files. You could work with some sort of average percentage that you have empirically established, and then take a margin, but if you want to get as close as possible to the 256MB limit you will need a script: try a combination, if not big enough, add a file, if too big, remove it again, etc.

You could submit it as an app idea on the Enfocus Appstore: https://www.enfocus.com/en/appstore/appmatch
jan_suhr
Advanced member
Posts: 592
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Sort Job PDFs into smaller zips less than 256 MB

Post by jan_suhr »

Freddy, I believe it was the second case. To assemble a group of files and ZIP-them but the ZIP-file must not be over 256Mb.

It can be solved with a looping flow that check how large the zip-file is and if it has room for more you can unpack it, add some more files to it and check again until it has reached its size.
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
NEOSA
Member
Posts: 39
Joined: Thu Mar 10, 2016 6:31 pm

Re: Sort Job PDFs into smaller zips less than 256 MB

Post by NEOSA »

Hi estaub

I don't know if this below will help you, but may be considering using 7-Zip (if your installation is Windows) + Execute-Command from Switch.

PDF-Tests is a folder of 440 Mb size

1 - You create a splitted archive from 7-Zip :

Code: Select all

C:\Program Files\7-Zip>7z.exe a -v[b][color=#BF0000]100m[/color][/b] "C:\Users\admin\Desktop\FOLDER\MyZIP.zip" "C:\Users\admin\Desktop\PDF-Tests"
Resulting Output = 4 files :

05/03/2020 13:49 104 857 600 MyZIP.zip.001
05/03/2020 13:49 104 857 600 MyZIP.zip.002
05/03/2020 13:49 104 857 600 MyZIP.zip.003
05/03/2020 13:49 3 249 686 MyZIP.zip.004

Each file is max 104 857 600 bytes, 100 MB (the last one [004] is 3 MB in this example).

2 - Store / Move the resulting folder with SWITCH where you need to.

3 - Later, you re-use 7-Zip to extract the whole content content :

Code: Select all

C:\Program Files\7-Zip>7z.exe x "C:\Users\admin\Desktop\FOLDER\MyZIP.zip.001" -o"C:\Users\admin\Desktop\Unzippezd-PDFs-from-Archive"
The whole content is unarchived/unzipped :

24/01/2018 13:12 225 240 090 29138_29138_NOR_MENSU-tri_2P ENORM 67000 pages.pdf
24/01/2018 13:12 225 240 090 29138_29138_NOR_MENSU-tri_2P.pdf
10/04/2018 17:32 <DIR> CARTES DE VISITES
10/04/2018 17:32 <DIR> DOCS
10/04/2018 17:32 <DIR> Fichiers-Reports
10/04/2018 17:32 <DIR> FLYERS

I don't know if it is you're really expect, may be it could help :-)

Ciao

## Updated ##

For a 256 MB file size each max

Code: Select all

C:\Program Files\7-Zip>7z.exe a -v256m "C:\Users\admin\Desktop\FOLDER\MyZIP.zip" "C:\Users\admin\Desktop\PDF-Tests"
7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21
Scanning the drive:
36 folders, 207 files, 462217267 bytes (441 MiB)
Creating archive: C:\Users\admin\Desktop\FOLDER\MyZIP.zip
Add new data to archive: 36 folders, 207 files, 462217267 bytes (441 MiB)
Files read from disk: 207
Archive size: 317822486 bytes (304 MiB)
Everything is Ok
estaub
Newbie
Posts: 9
Joined: Mon Oct 07, 2019 12:00 am

Re: Sort Job PDFs into smaller zips less than 256 MB

Post by estaub »

The exact MB size of the final zip does not need to be maximized, it just can't be larger than 256 MB. Generally the approach can be: sort PDFs into 256 MB batches and then zip each batch into whatever MB size it comes out to. These are variable data record archive batches to deliver back to a customer. I'll look into the looping approach and 7-Zip (I haven't used Execute Command yet). We unfortunately do not have the scripting module.

Has anyone been able to split a job into smaller jobs by file size? If that is possible each job could then be zipped.

Thank you for the responses.
Post Reply