Jump to content

how to exclude folder from file filter results


AndyD

Recommended Posts

Happy new year.
 
I have a problem  creating a filter
 
 I want to create a set of file filters that make it easy for me to find files created today, changed today, changed yesterday. Initially I tried to create spotlight saved search. (this used to work in older version of Mac OS)
 
The problem with using spotlight search is I use microsoft outlook to read mail. It creates a ton of file in "~/Documents/Microsoft\ User\ Data/“ Spotlight search does not provide a way for you to prune results under a directory. You can go to setting spotlight private and add this directory however that prevents spotlight from indexing these files. Outlook is not longer able to search your email. I called apple support and they confirmed my analysis. Very sad.
 
I am hoping to do some that is the sort of like the command bellow using Alfred
 
$ find ~ -daystart -ctime 0 print  | grep Microsoft
 
 
Unfortunately I could not find an attribute for working with paths. You get the folder name but no path info
 
 

$ mdls .

_kMDItemOwnerUserID                = 504

kMDItemContentCreationDate         = 2017-10-27 22:32:32 +0000

kMDItemContentCreationDate_Ranking = 2017-10-27 00:00:00 +0000

kMDItemContentModificationDate     = 2017-10-27 22:32:32 +0000

kMDItemContentType                 = “public.folder"

 

kMDItemDisplayName                 = "MusicTrainerCommonFramework"

 
Kind Regards
 
Andy
Link to post
1 hour ago, AndyD said:

Spotlight search does not provide a way for you to prune results under a directory. You can go to setting spotlight private and add this directory however that prevents spotlight from indexing these files.

 

Alfred uses the same metadata search index as Spotlight, so the exact same restrictions apply. It's "whitelist-only", and there's no way to exclude specific items other than to include everything but that. (That's not entirely true: you can exclude individual files and folders by tagging them with alfred:ignore, but tagging a folder doesn't hide its contents, so it's not a very useful feature.)

 

Your best best would be to try to get Outlook to move its data to a more sensible location in ~/Library. Emails don't really belong in ~/Documents, because it's not like you go in there with Finder to browse through them.

 

Failing that, there are a couple of other things you could try, like piping the output of mdfind (the command-line version of Spotlight) through grep -v.

 

In any case, if you can't move the directory you want to ignore somewhere else or exclude it universally via the Privacy pane, you're either stuck with a "whitelist everything else" approach or rolling your own.

Link to post

Hi Deanishe

 

thanks for the explanation. You suggested moving mail to  ~/Library . Is there something special about that directory? It seems I will still need spotlight to index these files else search in outlook will not work

 

Kind regards

 

Andy

Link to post
13 minutes ago, AndyD said:

Is there something special about that directory?

 

Not overly, but it's where most applications keep their "internal" data.

 

The main reason is that you can then search ~/Documents without all your emails showing up. If you're trying to search ~/, then it probably won't work.

 

Link to post

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...