How to zip files with a set limit of folder size?

I want zip files based on their size. Say if 1st File Size + 2nd File size <= limit size then compress those two files only. And repeat the same process for rest files in that folder.


You can create a collection of string and check the file lengths as

new System.IO.FileInfo(path).Length

you will get the size of the file in bytes

So you can define the limit size and always check whether it is in the limitsize then you add that path to the collection

later you can use Zip activity to zip those

Hope this may help you



Can you try the following sample?

Sequence2v3.xaml (14.7 KB)


1 Like

Hi @Yoichi Thanks Again. Can you explain this too ?


It’s roughly the following:

Get list of files, then iterate the files.

In the loop, get the file size of the target file.

If total size variable+ size of the file exceeds the limit, the existing folder will be zipped without including that file. Then, create a new folder and copy the files to it.

If total size variable+ size of the file does not exceed the limit, then simply copy the file to existing folder.

After exiting the loop, it compresses the last folder.


Got The process @Yoichi . You are a life saver :blush:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.