DELETE ALL FILES FROM /home/dev/unsecured/

Hi, I need delete all the files in Epic unsecured directory. Do you have any idea to deleting files all at a time?

Thanks for ideas and help


PD: I try node-red-contrib-fs-ops but dont works

Do you have shell access?

EDIT. Do you want to do this through Node-RED only?
So this is not a one time event? You want to be able to have a flow delete all the files at once?

Nop :frowning: but i can delete one by one with the file node-red block

And I want to delete all the files in one time event

We will put together a flow and test it here…stand by.

thanks a lot

Import this flow.

[{"id":"db45fd67.59a2e8","type":"exec","z":"9c7323c2.fcac3","command":"rm -r /home/dev/unsecured/*","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":480,"y":340,"wires":[["6dbbd840.55d72"],["6dbbd840.55d72"],["6dbbd840.55d72"]]},{"id":"baa0bb03.8dbaa","type":"inject","z":"9c7323c2.fcac3","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":240,"y":340,"wires":[["db45fd67.59a2e8"]]},{"id":"6dbbd840.55d72","type":"debug","z":"9c7323c2.fcac3","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":750,"y":340,"wires":[]}]

At the moment it has a manual inject, uses the ‘Exec’ node to run a Linux command and the debug is for information.
This is what it will look like;

Note that it will delete every file from the /home/dev/unsecured directory.
The rm is remove, the -r recursive and the * is everything.
Just be a little careful with this… But it will do what you asked…

Works with a few files, but the list of files is to long.

Wow. You really do have a LOT of files…
Can you tweak the command to delete them by batches?

Your right….a lot…lot…so very lot of files.
I delete by parts…for example:

rm -r /home/dev/unsecured/201906*
rm -r /home/dev/unsecured/201807*

And Works fine!!!
Thanks a lot…lot…lot!

1 Like