How to create ZIP archive from entire folder

I have read:

Something I cannot figure out if even possible is how to ZIP an entire folder. If this is possible could you give me example how to ZIP the Data folder?


You would have to use PHP to list all files in the folder and with a loop, zip all files returned.

scandir is what you need: