PaulL
16 April 2020 13:06
1
Hi,
I need to create a function to delete files if exists and after deleting I need to copy one file to another...
I start to write
import java.io.File; // Import the File class
public class DeleteFile;
public static void main(String args)
File f = new File("/data/hmi/M1/AUDIT/AuditTrail/~AuditTrail0.rdb");
if(f.exists() && !f.isDirectory()) {
f.delete();
}
but I have a lot of alarms and I don't know why.....somebody can help me?
Colin
16 April 2020 13:24
2
Mostly because node-red uses javascript not java. Apart from the name there is no relationship between the two.
Have a look at node-red-contrib-fs.
Colin
16 April 2020 14:03
4
What are the relative merits of fs-ops vs fs?
As far as i can see, node-red-contrib-fs only lists files where as node-red-contrib-fs-ops has this capability + copy/delete/stats/move etc etc
and as the OPs title was "Create a function for delete and copy files" I figured fs-ops was the way to go.
Colin
16 April 2020 14:14
6
Oh yes, sorry, I now realise I have both installed and thought those were from contrib-fs.
So yes, @PaulL you can use node-red-contrib-fs-ops and keep your javascript skills for when you really need them.
system
Closed
30 April 2020 14:14
7
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.