Delete Files in a specific folder after 30 days

Hello,

I just want to create a simple flow, where files in a specify folder on my laptop will be deleted if those are older than 30 days.

Could someone give me an example please?

Thanks in regards!

First thing to do would be to get a list of files in that folder, along with their file details, into a flow. So I would start by looking at the flows site for a Node that will help.

[{"id":"f4d0c5b8.b12428","type":"function","z":"828946d6.27bde","name":"Set filename","func":"//Path where to save your csv\nlet path = "/Users/thyle/Desktop/";\n\n// Get the current time and convert it to text\nlet now = new Date();\nlet yyyy = now.getFullYear();\nlet mm = now.getMonth() < 9 ? "0" + (now.getMonth() + 1) : (now.getMonth() + 1); // getMonth() is zero-based\nlet dd = now.getDate() < 10 ? "0" + now.getDate() : now.getDate();\nlet hh = now.getHours() < 10 ? "0" + now.getHours() : now.getHours();\nlet mmm = now.getMinutes() < 10 ? "0" + now.getMinutes() : now.getMinutes();\nlet ss = now.getSeconds() < 10 ? "0" + now.getSeconds() : now.getSeconds();\n\n//Get the sourceName \n//let sourceName = msg.filecontentWithHeader[0][1];\nlet sourceName = "CSV_File";\n\n//Set the filenname\nmsg.fname = sourceName + "" + yyyy + ""+ mm +"_"+ dd + ".csv";\nmsg.filename = path + msg.fname;\n\n\n// We are passing the file name search pattern to fs node to tell us if the file exists or not\nmsg.payload = {"pattern":msg.fname};\n\nnode.status({fill:"blue",shape:"ring",text:msg.fname});\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":370,"y":360,"wires":[["26a5109.eda207","fc2884bb.6a782"]]}]

This thread was very similar & should work with a small tweak.