# ZIP whole folder

**URL:** <https://discourse.nodered.org/t/zip-whole-folder/48656>\
**Category:** General\
**Created:** [20 July 2021 12:53 UTC](https://discourse.nodered.org/t/zip-whole-folder/48656 "2021-07-20T12:53:34Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![LucasJ98](https://avatars.discourse-cdn.com/v4/letter/l/ba8739/32.png) [@LucasJ98](https://discourse.nodered.org/u/LucasJ98)\
**Post date:** [20 July 2021 12:53 UTC](https://discourse.nodered.org/t/zip-whole-folder/48656/1 "2021-07-20T12:53:35Z")

</div>

Hi, is it possible to zip the whole folder if I don't know how many items are inside? Resp. I want to automate the backup of folders and somewhere there are also subfolders and different numbers of files.  
Thank you for all the help

---

<div class="post-metadata">

**Author:** ![leftymuller](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/leftymuller/32/102326_2.png) [@leftymuller](https://discourse.nodered.org/u/leftymuller)\
**Post date:** [20 July 2021 13:02 UTC](https://discourse.nodered.org/t/zip-whole-folder/48656/2 "2021-07-20T13:02:27Z")

</div>

Hi Lucas, Welcome to Node-red forum

you can use zip under linux or windows (command line) to do that with use of wildcards

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [20 July 2021 13:07 UTC](https://discourse.nodered.org/t/zip-whole-folder/48656/3 "2021-07-20T13:07:25Z")

</div>

And you can execute the appropriate command from node-red using an Exec node.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [20 July 2021 13:16 UTC](https://discourse.nodered.org/t/zip-whole-folder/48656/4 "2021-07-20T13:16:08Z")

</div>

Take a look at [node-RED Backup Flow](https://discourse.nodered.org/t/node-red-backup-flow/25033)  
That flow zips up all the necessary files, and uploads them to Dropbox.

---

<div class="post-metadata">

**Author:** ![LucasJ98](https://avatars.discourse-cdn.com/v4/letter/l/ba8739/32.png) [@LucasJ98](https://discourse.nodered.org/u/LucasJ98)\
**Post date:** [20 July 2021 14:45 UTC](https://discourse.nodered.org/t/zip-whole-folder/48656/5 "2021-07-20T14:45:00Z")

</div>

I need it backup to USB

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [20 July 2021 15:48 UTC](https://discourse.nodered.org/t/zip-whole-folder/48656/6 "2021-07-20T15:48:16Z")

</div>

> [@LucasJ98](#):
>
> backup to USB

It shouldn't be too difficult to change that flow, to save it to usb instead of dropbox. Just delete the dropbox node and the flow will then just save a zip file (of the node-RED essential files) by default at `/home/pi/.node-red/nodered.zip`, but you could edit the `dsm` node to save the file to a path of your choice.  
With a few further tweaks of the dsm node, you could save the file with a timestamped name, so that it would not keep overwriting the previously stored `nodered.zip` file.

---

<div class="post-metadata">

**Author:** ![LucasJ98](https://avatars.discourse-cdn.com/v4/letter/l/ba8739/32.png) [@LucasJ98](https://discourse.nodered.org/u/LucasJ98)\
**Post date:** [21 July 2021 06:25 UTC](https://discourse.nodered.org/t/zip-whole-folder/48656/7 "2021-07-21T06:25:39Z")

</div>

The whole project will basically work like this: When I connect USB it will automatically erase the USB and the files will find the last folders for each project and these will be ZIPed and saved to the connected USB.  
**Tasks** :  
USB detection - _done_  
Erase usb - _done_  
Find the latest folder - _done_  
Save to USB - _done_  
**ZIP folder with all files - incomplete**

future ideas if it will be possible:  
_- password encrypt ZIP_

---

<div class="post-metadata">

**Author:** ![LucasJ98](https://avatars.discourse-cdn.com/v4/letter/l/ba8739/32.png) [@LucasJ98](https://discourse.nodered.org/u/LucasJ98)\
**Post date:** [21 July 2021 10:39 UTC](https://discourse.nodered.org/t/zip-whole-folder/48656/8 "2021-07-21T10:39:59Z")

</div>

New problem :(. [BigFileReader](https://flows.nodered.org/node/node-red-contrib-bigfile) reads only 2GB. I need read and ZIP about 25-50GB files.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [21 July 2021 14:58 UTC](https://discourse.nodered.org/t/zip-whole-folder/48656/9 "2021-07-21T14:58:04Z")

</div>

Figure out what command and options you would need to do it outside of NR then pass that complete command to an exec node to do the zip. Leave the command option blank and check on the append msg.payload to command

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [19 September 2021 14:58 UTC](https://discourse.nodered.org/t/zip-whole-folder/48656/10 "2021-09-19T14:58:50Z")

</div>

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