How to read file date information

I am using node red to try to read the date information of the file and determine whether the file exceeds the storage period.everybody have a solution? thank you

try this

[{"id":"63aae358.20b5d4","type":"inject","z":"b779de97.b1b46","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"ls -l  new1.csv | cut -d \" \" -f5","payloadType":"str","x":120,"y":4480,"wires":[["aa74a8a7.d9a218"]]},{"id":"ae4ef9b4.4bd328","type":"debug","z":"b779de97.b1b46","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":590,"y":4280,"wires":[]}]

change the filename and its path. in the inject node.
This should return the size alone.

ls -l  filename | cut -d " " -f5

Thank you for your answer. This method is not applicable to my project. I need to process the file according to the returned information. Thank you again for your answer.

Why not? What information do you want about the file?

Hello, what I need is the date information of the file.

Install node-red-contrib-fs-ops

It has a selection of nodes, one of them can get attributes of a file.

1 Like

Thank you for your answer ,Let me test it.

ls -l  filename | cut -d " " -f 6,7,8

would give you the date and time


Thank you for your answer e1cid, Like one day in September, I can define it as day.

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