nikivi Posted September 21, 2017 Share Posted September 21, 2017 (edited) I want to exclude Folders, PDF, MindNode files and a few more from this search : Since I use dedicated searches for that and I want File Search to search for all the 'other' stuff that is on my system. I can't find anywhere where I can blacklist certain file types for that. Edited September 21, 2017 by nikivi Link to comment
nikivi Posted September 24, 2017 Author Share Posted September 24, 2017 (edited) Or perhaps I can make a file filter where I can define to search for ALL file types by default like File Search does already. And then just exclude the file types I don't need. Currently File filter starts as search all files by default and then adding file types scopes search to the file types added. I want to instead blacklist file types from the file search. Nor does there seem to be an option to exclude certain file types from default File Search it seems. ? Edited September 24, 2017 by nikivi Link to comment
GuiB Posted September 24, 2017 Share Posted September 24, 2017 (edited) This is not the best solution, but I don't know if there's a better one... Using a file filter, in the 'Advanced > Fields' section you can tick the 'NOT' checkbox in the when adding Metadata fields. So, you can use this to blacklist file that contain certain keywords. Here is a screenshot to show you how to blacklist items that contain '*.cpp' or '*.h' in their Display Name (so using the file extension to filter different types). You can try different combination using different metadata fields to best filter what you don't want. Edited September 24, 2017 by GuiB Link to comment
nikivi Posted September 24, 2017 Author Share Posted September 24, 2017 (edited) It did not seem to work for me. With these settings : I get these results : So it still returns .pdf files. Unless I made a mistake somewhere. Edited September 24, 2017 by nikivi Link to comment
GuiB Posted September 24, 2017 Share Posted September 24, 2017 (edited) It's because you're hiding the file extension in Finder so the "Display Name" doesn't use it. Therefore, you need to use another metadata field to filter your file, you should be able by using a 'kMDItemAlternateNames' or a 'kMDItemFSName' field instead of a 'kMDItemDisplayName' Edited September 24, 2017 by GuiB Link to comment
GuiB Posted September 24, 2017 Share Posted September 24, 2017 Ah, just thought of a better way Just use a 'kMDItemContentType' in the Metadata Fields so you can directly filter the file type wanted instead of using the file extension... This should be better and the opposite of Alfred filter by type. Look at the screen capture to how to put it. If you're wondering about the Value to use for the file type that you want to exclude, first go into the 'Basic Setup' section and drag & drop the a file of the type that you want to exclude in the 'File Types' section. Copy the first value and remove it from the list. Go back to the 'Advanced' section and paste it. nikivi 1 Link to comment
Andrew Posted September 25, 2017 Share Posted September 25, 2017 Using the kMDItemContentType will be the highest performance too Link to comment
nikivi Posted September 25, 2017 Author Share Posted September 25, 2017 (edited) Awesome. Thank you a lot @GuiB Just to make sure I understand correctly but Alfred's File Search is the same as creating a default new File Filter right? Just to make sure I am not missing anything that File Filter will catch. Edited September 25, 2017 by nikivi Link to comment
Andrew Posted September 25, 2017 Share Posted September 25, 2017 @nikivi Alfred's default file searches use the same workflow File Filter under the hood Link to comment
GuiB Posted September 25, 2017 Share Posted September 25, 2017 From my understanding File Filter and Alfred’s File Search use the same technique (thanks @Andrew for confirming ). However, from my understanding, a default File Filter won't use the same configuration has your Alfred's File Search if you've filtered some file types in your Alfred's File Search section, so it won't show the same output ( @nikivi , if this is what you're wondering). @Andrew , please correct me if I’m wrong, but in the 'Basic Setup > File Types' section of a File Filter, it’s written: "Leave empty to search all file types". So, from my understanding, by default, a File Filter would show any files of any types, even if you've checked some file types in the 'Don't Show' section of the File Search, those would be shown. So, if you don't want them, you would also need to filter them using the same technique as above; using the 'kMDItemContentType' Link to comment
nikivi Posted September 25, 2017 Author Share Posted September 25, 2017 @GuiB's solution works really well and it solves my problem. However how I can I now blacklist folders from my default search? I can add folders to the search scope window, but then file filter will search only through those folders. I tried to use this : And pass in the path I want to blacklist. But perhaps I misunderstand the meaning of kMDITemWhereFroms as that did not work. It would be quite awesome if you you could blacklist things from 'Search Scope' itself. i.e. add folders there like you do know but have a checkmark somewhere that instead of only searching these folders you give, it would actually search everything else but the folders passed in. Link to comment
nikivi Posted September 25, 2017 Author Share Posted September 25, 2017 Also I get a strange bug. With these settings : I get these results running the file filter : As you can see learning is a folder and yet it somehow passes the filter. Most other folders do get blocked though so that's good. Link to comment
nikivi Posted September 25, 2017 Author Share Posted September 25, 2017 (edited) Here's metadata of that folder from @Andrew's metadata app : /Users/nikivi/learning Internal File Metadata ====================== Display Name: learning Alt Names: File Type: public.folder Comments: Keywords: Last Used: 2017-09-25 23:03:43 +0000 Raw mdls File Metadata ====================== _kMDItemOwnerUserID = 501 kMDItemContentCreationDate = 2016-11-26 11:08:37 +0000 kMDItemContentModificationDate = 2017-09-25 23:03:43 +0000 kMDItemContentType = "public.folder" kMDItemContentTypeTree = ( "public.folder", "public.directory", "public.item" ) kMDItemDateAdded = 2016-11-26 11:08:37 +0000 kMDItemDisplayName = "learning" kMDItemFSContentChangeDate = 2017-09-25 23:03:43 +0000 kMDItemFSCreationDate = 2016-11-26 11:08:37 +0000 kMDItemFSCreatorCode = "" kMDItemFSFinderFlags = 0 kMDItemFSHasCustomIcon = (null) kMDItemFSInvisible = 0 kMDItemFSIsExtensionHidden = 0 kMDItemFSIsStationery = (null) kMDItemFSLabel = 0 kMDItemFSName = "learning" kMDItemFSNodeCount = 6 kMDItemFSOwnerGroupID = 20 kMDItemFSOwnerUserID = 501 kMDItemFSSize = (null) kMDItemFSTypeCode = "" kMDItemKind = "Folder" kMDItemLastUsedDate = 2017-09-25 23:03:43 +0000 kMDItemUseCount = 10 kMDItemUsedDates = ( "2017-01-05 23:00:00 +0000", "2017-02-20 23:00:00 +0000", "2017-06-08 22:00:00 +0000", "2017-07-28 22:00:00 +0000", "2017-09-02 22:00:00 +0000", "2017-09-16 22:00:00 +0000", "2017-09-22 22:00:00 +0000", "2017-09-25 22:00:00 +0000" ) Edited September 25, 2017 by nikivi Link to comment
GuiB Posted September 26, 2017 Share Posted September 26, 2017 I don't get exactly what you want... your want to exclude every folder or you want to exclude specifics folders? If your question is the first one, then using 'kMDItemContentType' as Metadata field with 'NOT' ticked and 'public.folder' as value should do the job (it works on my side). You problem with your folder '~/learning' is because it's added by Alfred's Default Results Search Scope. Look inside 'Features > Default Searches > Search Scope > Include folders in Home' if it is checked. If so, all you folder inside your Home folder should appear in your search since they are explicitly added. Or folders that are added inside the Alfred's Default Search Scope list should appear as well. Was that your problem or you have other folder from different places ? If your problem is to exclude specific folders, then the problem with Spotlight/mdfind is that you can add folders to search inside those specific folders, but you can't exclude some to filter them from the added parent folders. So, a solution would be to add every folders that you really want to look inside. I know this could add a pretty big list of folders, so I thought of another solution... Just add a Finder Comment or a Tag to the folders that you want to exclude and do the same thing as the 'kMDItemContentType' and exclude files that are marked with your comment/tag... For example: add a comment to your '~/learning' folder (ex: 'AFF_Exclude' -> for Alfred File Filter Exclude) and in the Metadata Field insert 'kMDItemFinderComment' and tick the 'NOT' box and in the value insert 'AFF_Exclude'. This should work and would keep your default filtering as it is, but with extra exclusion of specific items. About your 'kMDITemWhereFroms', from Apple documentation, this should "describes where the file was obtained from. For example, a downloaded file may refer to the URL, files received by email may indicate the sender’s email address, message subject, etc." So, this is not so useful in your case. Link to comment
nikivi Posted September 26, 2017 Author Share Posted September 26, 2017 3 minutes ago, GuiB said: your want to exclude every folder or you want to exclude specifics folders? I want to change the scope of the search from searching the entire system to searching the entire system except these few folders. 4 minutes ago, GuiB said: If so, all you folder inside your Home folder should appear in your search since they are explicitly added. This explains it. Thank you. I don't mind then to have these few folders shown in this file filter. 6 minutes ago, GuiB said: Just add a Finder Comment or a Tag to the folders that you want to exclude and do the same thing as the 'kMDItemContentType' and exclude files that are marked with your comment/tag... That sounds extremely annoying for what I want to do. I just want to change the scope of the search from all to all but not these folders without editing meta data of the folders just to achieve this. ? Link to comment
deanishe Posted September 26, 2017 Share Posted September 26, 2017 4 hours ago, GuiB said: Just add a Finder Comment or a Tag to the folders that you want to exclude and do the same thing as the 'kMDItemContentType' and exclude files that are marked with your comment/tag.. Use comment “alfred:ignore” and the second step is unnecessary. Link to comment
GuiB Posted September 26, 2017 Share Posted September 26, 2017 @deanishe, I didn't know that one! Thanks for mentioning! However, the problem with using "alfred:ignore" is that this would make the commented file to be ignored completely from all Alfred searches. However, what @nikivi want is to exclude specific items from a specific file filter, so they can be found from certain file filter and not from other. Therefore, I think my solution of a custom comment/tag name would be best. @nikivi, I don't think it's so much more annoying to comment files than to copy their path and paste them inside the File Filter (like you tried before, which didn't work). From how you speak, this seem to be only certain files, so wouldn't take too long and everything would be good after. If it's because you are afraid to find those files from other kind of searches that look for Finder comment, than make sure to use a custom comment that you are sure you won't write by accident. Link to comment
ioemilio Posted March 17, 2021 Share Posted March 17, 2021 Is the advanced file search option still available in the latest version of Alfred? I cannot find it anywhere! Link to comment
Vero Posted March 17, 2021 Share Posted March 17, 2021 @ioemilio Which feature are you referring to? To use the broader search, prefix your search term with a space (shortcut to the "open" keyword). Might be worth taking a look at our intro guide to searching using Alfred for all the details on default search, finding files and documents, etc: https://www.alfredapp.com/blog/tips-and-tricks/beginners-guide-to-alfred-searching-your-mac-and-the-web/ Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now