Page 1 of 1

Regarding deletion of files using scripting language

Posted: 04 Jun 2017 08:33
by akhileshg1988
Hey there!
Just wanna know if I could use the action "Script" to delete files. Is there any function to do that?

Note:- I know that there's this action "Delete Files", so please don't suggest that. It's just that my flow requires using script to delete certain files.

Re: Regarding deletion of files using scripting language

Posted: 05 Jun 2017 19:13
by Martin
Hi,

That's only possible indirectly. You could use the the Java features of action script to instantiate a File object and call delete on it. Something like this should work:

Code: Select all

file=callJavaConstructor("java.io.File", "File(java.lang.String)", "/storage/emulated/0/test.txt");
callJavaMethod(file, "java.io.File", "delete()");
Regards,
Martin

Re: Regarding deletion of files using scripting language

Posted: 06 Jun 2017 04:18
by akhileshg1988
Thanks a lot Martin. That was a lot of help. Really invaluable.

Akhilesh