Save created zip via :zip.create/3 to a specified directory

Hi! I have to create a zip file and save it to a specific location. By default, :zip.create saves the created zip in my default CWD, zip saves and works fine, then I tried updating my cwd to a path inside the current cwd (to the path of a temp folder I need my files to be saved) but the :zip.create function returns {:error, :enoent} and saves a broken zip file. Did I misuse the :zip.create/2 function here?

:zip.create/2/3 will return the name of the file created IIRC. Just take that and move it somewhere you want it.

The :cwd option of :zip.create/3 will only affect the base of the generated pathes in the archive, not where the file is created. At least from how I understand the documentation.

2 Likes

That works! Thank you!