0

I am building a webpage that indexes files on my system (macOS). I would like to be able to add two hyperlinks to each file, one which a) opens the file, and one which b) reveals the file in the finder.

Regarding a), I can open a file with the following URL:

file://…

However, this displays it in the browser window, whereas I would prefer to open it in the default application. So not quite what is needed.

Regarding b), I have no idea if such a URL scheme exists, but would appreciate it if anyone knows how to achieve this.

I have been able to achieve it by passing the file path to Keyboard Maestro and then using a macro to open / reveal the file. However, I would prefer to achieve this without any intermediate application.

0

The file:// path is generally just file:// and then the files path.

One way to do it in Finder is to right-click the file then press "Get Info", or select the file and Command + I (shortcut) to bring up the files information.

You can find the file's path next to "Where:" (under General). You can just copy that (Command + C or Edit > Copy) and paste that (don't worry, it will be copied as a UNIX path (e.g /users/Name/My Folder)

Now, in your browser you can just type: file://(paste in the path you copied)/files name

edit: Someone edited your question so now i'm not too sure what your intention is.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.