Filemanager - bulk delete of non private files

Hi,
how can I delete hundreds of files that are not marked as private?

1 Like

I have used the following successfully on ‘things’ in my database - I hope (and assume) it can be used on files (as long as you use the correct corresponding datatype), but not positive. So please report back on your findings :slight_smile:

Also take note - if these are files in the live database, make sure you switch your editor view to ‘Live’ so you’re deleting the files there and not from Dev.

You will need to create a Backend workflow (you may need to enable these in your settings, under the ‘API’ tab, ‘Enable Workflow API and backend workflows’). Under the ‘Workflow’ tab, now choose the dropdown where you’d typically choose your page, but instead click ‘Backend workflows’. Create a new Backend workflow, and choose ‘New API workflow’. Give it a name, and click ‘Add a new parameter’. The word you use for the ‘key’ isn’t as important, but I’d give it something similar to the data type in case you need to reference it. Once you give it a key, you can choose the ‘Type’ – make sure this is the type of data you are deleting. You do not need to choose the checkbox ‘is a list/array’.

Now add an action (step 1) to the workflow telling it what to delete: Choose ‘Delete a list of things’, and then Type of things, choose the data type you need to delete. “List to delete”, do a ‘search for [data type things]’. Now click on this search, and click on the button ‘Add a new constraint’. This is where you’ll choose ‘Public’ = ‘No’ (or however you’ve marked your data as not public). This will constrain the delete action only to these non-public things.

Finally, go to the ‘Data’ tab, click on the data type, and choose the tab ‘App data’. On the top right of the spreadsheet view is a button ‘Bulk’. Click this, and under the ‘API workflow’ dropdown your Delete workflow should be available and in black font (if it were gray it would mean there was a mis-alignment of data types or similar). Choose it, and it will tell you how many items are about to be affected by it. Finally, click ‘Run workflow’. This will delete the files that are not marked as private.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.