Regarding deletion of files using scripting language

Post your questions and help other users.

Moderator: Martin

Post Reply
akhileshg1988
Posts: 109
Joined: 16 Apr 2014 04:57

Regarding deletion of files using scripting language

Post by akhileshg1988 » 04 Jun 2017 08:33

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.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Regarding deletion of files using scripting language

Post by Martin » 05 Jun 2017 19:13

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

akhileshg1988
Posts: 109
Joined: 16 Apr 2014 04:57

Re: Regarding deletion of files using scripting language

Post by akhileshg1988 » 06 Jun 2017 04:18

Thanks a lot Martin. That was a lot of help. Really invaluable.

Akhilesh

Post Reply