Select and delete certain files recursively

Hi,

I'm trying to add a button to DO8 that will select and delete all "Thumbs.db" files in the selected folder(s). Any help is much appreciated :slight_smile:

Cheers,
Monica

The Delete Filter in Opus should be perfect for this.

The first time you do it try in a test folder just to make sure you've got everything right since a badly defined delete filter can have disastrous results (obviously!).

[ul][li]From the default menus, select Settings -> Delete Filter.[/li]
[li]Select the directory or directories in which you want to delete things.[/li]
[li]Click the delete button.[/li]
[li]A window should appear where you can define your filter using the drop-down options.[/li]
[li]Set the filter to something like Name Match Thumbs.db[/li]
[li]Click okay and you're done.[/li][/ul]Important: If there are any files selected when you click delete then they will be deleted regardless of the filter. The filter is only applied when recursing through the selected sub-folders; Opus assumes if you explicitly selected a file then you want to delete it, whether or not it matches the delete filter.

Hmmm. Is it just me, or would it be helpful to be able to test / preview the files that will be deleted by proceeding with a delete filter?

All the best,

pt

Delete filters are the same as (Advanced) Find filters so you can test them using the Find tool. If you save such a filter in either tool you can load it into the other.

The only real exception is that delete filters are not applied to the selected files; only within the selected folders while the selected files get deleted no matter what.

Thanks Leo, that does the job, but I would like to go one step further if that's ok :slight_smile: The method you suggested is not very informative - doesn't show you what's happening, how many files are going to be deleted etc.

So, I'm thinking about a button that does a find on the selected folder(s), puts the results into a collection (eg. "Find Result") and then deletes the contents thereof.

I played with the Find command to begin with:

Find CLEAR NAME=Thumbs.db FILTER RECURSE

but when I add IN={filepath$} to start the search automatically, it just stops. Maybe I'm doing something obviously wrong...

Cheers,
Monica

Try removing the FILTER argument from your command.

(That is telling Opus that the NAME argument is supplying the name of a filter, rather than the name of the file to search for, but in this case you are giving it a filename not a filter.)

1 Like