Jump to content

MDQuery, File Search troubleshooting & Search Scope Fix

Recommended Posts

I had a frustrating issue with Alfred being unable to find a particular directory of files that I've had for a number of years. When running the file troubleshooting, Alfred would report the file existing within the default search scope but would then fail down the bottom at the MDQuery search.


If I renamed the file, it would appear in Alfred but over time randomly it would just fail again. Super weird.


Reindexing and deleting the V100 didn't work, the official bandaid is to broaden the search scope to the full disk, which works, but that just makes search return so much junk it's not tenable. 


Looks like this:



Managed to figure out, it was some old Xattr attibutes from dropbox that was the issue. My files were in dropbox but moved out and into icloud.


It goes without saying please make a backup before making any changes. 


From the terminal if you run:

xattr -l yourfilename


and you see either of these attributes (screenshots attached):





That'll be the reason they aren't showing up in Alfred.


Remove the attributes with this command: 


xattr -d com.dropbox.attrs your-file-or-folder-name


xattr -d com.dropbox.attributes your-file-or-folder-name


I had decades of files to change so just gave the middle finger to dropbox and changed them all with this command:


find "/path/to/your/red/headed/stepfiles" -exec xattr -d com.dropbox.attrs {} \; 2>/dev/null


find "/path/to/your/red/headed/stepfiles" -exec xattr -d com.dropbox.attributes {} \; 2>/dev/null


Alfred will pick them up straight away and deliver them with metadata unchanged on a silver platter to much fanfare. And with the search scope set at default to boot.


This problem has plagued me since Monterey and it looks like it's a bit of an edge case so posting this for posterity, hope it helps the other 3.2 people in the world that moved old dropbox files.






Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...