Delete file using FileManager?


#1

Would it be possible to add a delete(path) function to ’FileManager` so that we can delete files from a script?


#2

Perhaps through a Workflow delete action ?

( The intersection of ‘script’ and ‘delete’ can be quite a dangerous place )


#3

What is the use case you’re thinking of? Is it for active file management or for removing temporary or cached data? There may be safer alternatives.


#4

Since I don’t know how to store a token in Credential I’m currently storing it in a file using FileManager. The service that requires this token might invalidate it. I would like to delete the file when that happens (instead I currently write an empty string to that file).


#5

I’d just use a dot file with your existing approach. Out of sight out of mind. Can’t be more than a few hundred bytes.


#6

Did not think of starting the name with a dot. Good suggestion! Thanks.


#7

I’d be interested in delete support as well. I have an action to save out files with a specific set of tags. Periodically, I like to update the saved files to match whats in drafts. It would be nice to be able to delete the folder first, before saving the new files, to handle drafts that have been removed and I’d like to delete from the Drafts folder as well.

I handle this manually now, periodically deleting the folder from the Files app, and then saving again. It would be nice to have support for automating this, edven knowing that deleting from scripts can be a dangerous combination.