Monday, January 28, 2019

Spotlight and File Full Path

I remember that long time ago, I can use Spotlight to make a copy of file/folder's full path, just by pressing cmd+c keys if the text is a file/folder. However, this feature seems not working in resent macOS anymore (High Sierra or Mojave).

Even though, I realize that the spotlight can still reveal full path when cmd key is pressed. This feature is available in High Sierra or Mojave. As seen in the following snapshot.



By the way, above screen shot was hard to make(any screen shootout keys will make the path disappeared). I had to record the section screen first and then to take snapshot from the recorded video.

One interesting thing is that I found a way to get full path! By chance I accidentally pasted my clipboard in Safari's address bar one day. I got the full path. As show in the following snapshot:



That's very interesting finding. There are more places I can get full path. Safari's search bar, Notes app search bar. However, it is not working in Terminal app directly, nor in Finder's search bar. I think Finder's search bar is actually a spotlight.

Anyway, I could not find this solution in web. Maybe this is a undocumented trick in macOS. In this way, file/folder's full path can be obtained indirectly from some app's bars. From there, the path text can be copied as text when it is selected, as for the above example:

/System/Library/CoreServices/Applications/Screen Sharing.app

UPDATE: recently I updated my Mac to macOS Catalina. Unfortunately this feature is not available in this new OS. I could not paste a copy I made in Finder for a file or folder item to Safari's address bar as a full path string.

However, the full path can be obtained in Terminal by cmd+v paste!

Another finding is to jump to a file's location in Finder from Spotlight. For example, type something like "iTunes" in Spotlight. You will see the first item in result list is iTunes - Applications.


Hold Cmd key and double click on this item. You will jump to the file in Finder. From there you can make a copy



and paste it to Terminal to get its full path.


No comments: