Skip to content

Problem with MDfind query #8

@jacoblyw

Description

@jacoblyw

Hello,

I modified your script to move files to the trash (instead of deleting them directly) to make sure it behaved as expected.

I then tagged 3 files with "1 Minute". Imagine my surprise when 13 files appeared in my trash after the first run of os-x-self-destruct.

The problem seems to lie with the query
mdfind "tag:$1"

mdfind "tag:1 Minute" catches some files, mdfind "tag:1 Day" others, and so on...

NONE of my files have any of the following tags:
1 Minute, 1 Hour, 1 Day, 1 Week, 1 Month, 1 Year

This may be an undocumented bug or "feature" within Spotlight as the query mdfind "tag:2 Day" also finds a bunch of files with no tags set.

I've changed the query to mdfind "kMDItemUserTags == '$1'" and also the tags to avoid any possibility of confusion ("1 Minute" to "DeleteIn1Minute", etc.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions