How to zip all files into multiple folders and send separately

Hi All,
Currently I have a requirement which is to send multiple zipped folders to the recipient through Outlook. But, each and everytime we execute the process, it will generate, save a few hundreds of PDF files from SAP and we will need to send them out in zipped folders.

Question is, each email can only cater up to less than 25MB per mail with attachments, how can we zip all the PDF according to the attachment size limit for mail and send accordingly with the zipped folders(like first mail sending zipped folder with the top 10/20 PDFs, second mail be the 21-40th PDFs).

Hi @quan9784 !
Here are some clues, if I get time to do the workflow by the day I will let you know.

  • to get the size of a file, you can use FileLen(name_of_file_dot_extension) → it returns an int32 in bytes
  • once you get all the files in a variable (let’s say a string[] thanks to a Directory.getfiles(repository_path)) you should go through all files, try to cumulate file sizes in a sum until you reach the limit of 25MB, and just before arriving to the limit, zip and move the files. Then redo a directory.getfiles() to always have the files up to date, and so on

Hi @Hiba_B ,
Thanks for the idea/suggestion. Maybe could you provide me a brief workflow on how to achieve the separation and sending in email? :slight_smile:

@quan9784 Alright, I think that I might have time for it today :wink:

Hi @quan9784 !
Here is a suggestion, let me know if it fits your requirements.
Note that I take into account only .pdf files, not .PDF files (case sensitive). If you want me to take them into account, just let me know and I’ll modify it.
Sendmailzippedfolder.xaml (9.9 KB) zip_according_to_size_limit.xaml (20.3 KB)

Don’t forget to adapt all the string arguments of zip_according_to_size_limit.xaml


And don’t forget to put at the same level zip_according_to_size_limit.xaml and Sendmailzippedfolder.xaml

Let us know if it does not work as expected !

1 Like