Spotlight: How to input approximate file path information into search query?

Discussion in 'macOS' started by ICEBreaker, Sep 26, 2009.

  1. ICEBreaker macrumors 6502

    Joined:
    Aug 12, 2007
    #1
    The original message was too long, so here is a shorter version. Suppose I have the following file structure: \Joe\birthday\photos\. I want to type, "photo, joe" to get me to the "photo" folder. Is there a simple way to do something like that? Thank you!


    --- ORIGINAL MESSAGE ---

    Dear Mac fans,

    Spotlight seems to only allow users to find files but without relation to where the file might be located. This works fine if the filename is "New_York_Birth_Rate_2008.pdf". How about if it's stored as "Birth_Rates\New_York\2008.pdf"? Searching for "2008.pdf" would bring up a whole host of files and one could select the one in the right folder. But what if you have a large number of files called "2008.pdf", stored under various folders (birth rate, mortality, morbidity, rain fall, humidity, crime rate, etc etc etc" and you want to narrow the search? Sure, one could use the advanced search, but this defeats the purpose of a file launcher like Spotlight.

    Ideally, I want to input something like, "new york, birth, 2008" in any order and it would search for all folders and files with similar names, sorted by placing ones with more matched terms in terms of the file path. Is there an input method to do this? Surely this is a common scenario?

    Here's another example, "Sales Person A\Bronx\2009\Sept\Insurance Plan A.pdf". Now imagine I have 200 sales persons, and 50 areas. I want to type "richard, longevity plus.doc, bronx" to narrow the list. Sure, I can use advanced search, but as I said, this defeats the purpose of spotlight.

    Thanks a lot for your help.
     
  2. SilentPanda Moderator emeritus

    SilentPanda

    Joined:
    Oct 8, 2002
    Location:
    The Bamboo Forest
    #2
    If those words are contained in the PDF's also, won't spotlight find them just the same without the commas?
     
  3. ICEBreaker thread starter macrumors 6502

    Joined:
    Aug 12, 2007
    #3
    Excellent point there! But in some cases those terms won't appear inside the file itself. I'll give you an example of a case where you have a folder to store letters to soothe investment clients about their recent losses in the FX market: "Clients\Letters\Low Asset Classes\Forex Margin\Large Losses\". In this case, you wouldn't have the word "clients", or let them know they are only classified as "low asset class" clients, nor would you use blunt words like "large losses" in the letter.

    Or how about this simple example, which I think many people can related to. "\Joe\birthday photos\DSC00123.jpg". Here, I have no idea what the file name is. I want to type, "photo, joe" to get me to the enclosing folder of "photo".
     
  4. SilentPanda Moderator emeritus

    SilentPanda

    Joined:
    Oct 8, 2002
    Location:
    The Bamboo Forest
    #4
    Hrm. Well I'm not sure you can do exactly what you want. But, if you right click on the file and select Get Info, there is an area for Spotlight comments. Depending on your volume of files you might be able to write an automater/applescript to embed the directory in the spotlight comments, or just go in and hand type them. Then you can attach a folder action to all your folders that auto adds the path to future files spotlight comments.

    Not exactly what you want, but a possible way to help maybe.
     
  5. ICEBreaker thread starter macrumors 6502

    Joined:
    Aug 12, 2007
    #5
    OK, thanks a lot for your help, and some workaround ideas.
     
  6. TranceNW macrumors regular

    Joined:
    Aug 18, 2007
    Location:
    Essex, United Kingdom
    #6
    In spotlight I would search for joe birthday photos, and then command-click the spotlight result to take me to the enclosing folder.
     
  7. mysterytramp macrumors 65816

    mysterytramp

    Joined:
    Jul 17, 2008
    Location:
    Maryland
    #7
    I think what you're describing is what Advanced Search is for -- although I don't think Spotlight as an "advanced search" just more options.

    In your first example, you could look for name "Joe" and kind "JPEG" right?

    mt
     
  8. ICEBreaker thread starter macrumors 6502

    Joined:
    Aug 12, 2007
    #8
    Thanks TranceNW. My abridged enquiry was rather misleading. Anyway, thanks for you help.

    Hey, hi MysteryTramp again! How are you doing. Well, the point of Spotlight is to launch files quickly. So using Advanced Search wouldn't be feasible for my purposes. As for your suggestion, using "Joe" and "kind: JPEG" would bring up all photos of Joe, rather than just the birthday photos.

    Oh well, I guess there is no way of doing it then. Thanks all.
     
  9. mysterytramp macrumors 65816

    mysterytramp

    Joined:
    Jul 17, 2008
    Location:
    Maryland
    #9
    I was thinking that if you found a photo of Joe, you'd probably find the photos of Joe's birthday party ...

    This might not be terribly useful, but an alternative would be to be religious at entering Spotlight comments on your files ... potential pain in the neck ... however, if on your hard disk the file path is indicative of content, you could do this:

    Code:
    on open filez
    	tell application "Finder"
    		repeat with fn in filez
    			set pathString to (fn as string)
    			set currComment to comment of fn
    			set comment of fn to currComment & return & pathString
    		end repeat
    	end tell
    end open
    Save it as an app, and it becomes a droplet. It leaves the previous comment -- though it doesn't do any error checking on whether the old comment and the new file path exceeds 750 characters, which I believe is the limit.

    The minimal testing I gave it just now made it seem to work.

    mt
     
  10. ICEBreaker thread starter macrumors 6502

    Joined:
    Aug 12, 2007
    #10
    Wow MysteryTramp! You did it again. Thanks a lot for taking the time to write the script out. It's very kind of you. Such a helpful person. I'll give it a try, though I don't think I'll have the discipline and tenacity to tag and comment my files for long. Thanks a lot!
     
  11. mysterytramp macrumors 65816

    mysterytramp

    Joined:
    Jul 17, 2008
    Location:
    Maryland
    #11
    Just tried something that could make life a little easier ... you can put a droplet AppleScript into the sidebar, so as you peruse your files, you can drag them -- whole batches of them -- onto the droplet and automatically comment them.

    Your solution is better -- have Spotlight recognize a path as part of a file name -- but this might solution might be less of a pain in the neck than I thought.

    mt
     
  12. ICEBreaker thread starter macrumors 6502

    Joined:
    Aug 12, 2007

Share This Page