ZIP whole folder

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

Hi Lucas, Welcome to Node-red forum

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

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

Take a look at node-RED Backup Flow
That flow zips up all the necessary files, and uploads them to Dropbox.

I need it 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.

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

New problem :(. BigFileReader reads only 2GB. I need read and ZIP about 25-50GB files.

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

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