2

I work at a small office where everyone uses Macs. We have a shared SMB server for storing files, which often contain spaces and other special characters.

Let's say that I have a folder containing important data for a coworker. Our current workflow is:

  1. I take a screenshot of the folder path in Finder: 1]
  2. I attach this screenshot to an email and send it to my coworker.
  3. My coworker uses the screenshot to manually navigate to the correct directory in Finder.

We do this many times each day, and it adds up. Step 3 in particular is quite annoying for the recipient.

Is there a technique we could use, or some software we could install, that would expedite this process? Ideally, I'd like the ability to email a "link" that, when clicked, would automatically open the directory in Finder.

Again, this method must be compatible with special characters, and should be easy to explain to less technically savvy users.

  • There are two main stoppers: 1. The path needs to be url-encoded to work if there are spaces or special characters (spaces to %20, etc) and 2. The Finder tends to directly mount the last folder in the path. So //server/files/important_files/secrets.txt might mount as just the important_files directory, with no path hierarchy. – joemaller Sep 15 '16 at 4:53
  • Also Automator (and several scripting languages) can't seem to access the full smb:// address, they all reference the file from its mount point in /Volumes. Similar question: How can I copy the full smb:// link from a file in Finder? – joemaller Sep 15 '16 at 4:58
4
  1. Right-click the file or folder in Finder > Services > Copy full path
  2. Paste the path into the email (I used Apple Mail)
  3. The recipient just has to choose the whole path in the email and right-click it > Reveal in Finder

You don't have to escape spaces in the path with backslashes! The share has to be mounted already.


If you don't find a service like "Copy Path" or "Copy full Path" you can simply create it yourself:

  1. Launch Automator
  2. Create a new service
  3. Search for “Copy to Clipboard” and drag that into the rightside panel of the Service
  4. Set ‘Service receives selected’ to “files or folders” and ‘in’ to “Finder” at the top of the service.
  5. Save the service as "Copy Path"
  6. Depending on your system you can copy the path either by right-clicking an item > Copy Path or Services > Copy Path.
  • This sounds promising, but I don't understand Step 1. There is no "copy full path" option in Finder's right click menu. – Wowfunhappy Sep 15 '16 at 13:00
  • @Wowfunhappy Hmm, I have to investigate this. Maybe some 3rd party app/service is installed here. I suspect Path Finder has installed this service. – klanomath Sep 16 '16 at 0:37
  • Unfortunately the path is to the mounted path. (Volumes/) Which is different from path to server. (smb://) – Bruno Jan 21 at 4:53
  • PathFinder and Path Snagger both have finder extensions to help with smb://where/whatever to \\where\whatever to /Volumes/whatever -type gyrations and translations. – bmike Mar 10 at 19:29
1

I created an Automator workflow that gets the full path to file or folder. It replaces the (/Volumes/mountName) with the actual server address and encodes the path as URL. (Meaning you can send this to a colleague who might not have the server mounted or mounted differently):

MOUNTCHECK=$(echo "$1" | cut -d "/" -f2)
if [[ "$MOUNTCHECK" == *"Volumes"* ]]; then
  MOUNT_NAME=$(echo "$1" | cut -d "/" -f3)
  FILE_PATH=$(echo "$1" | cut -d "/" -f 4-)
  MOUNT_INFO=$(mount | grep "$MOUNT_NAME")
  MOUNT_USER="${MOUNT_INFO/\/\/${USER}@/}"
  SERVER=$(echo $MOUNT_USER | awk '$0=$1')/
  echo $SERVER$FILE_PATH
else
  echo `echo $1 | perl -pe 's/File//g'`
fi

Download the Automator workflow.

1

If you're on Mojave, they've changed the default so now command-option-C on a file copies the smb path with the URL rather than the /Volumes/ path.

  • Hi dennitzio, welcome to Ask Different! Mind clarifying what you mean by Command-Shift-Copy? I’ve tried Command-Shift-C but that won’t work for me. Are you referring to the menu command? – Synoli Mar 9 at 9:51
  • 1
    Yeah I’m an idiot, I meant command-option-C, which is also accessible with holding the option key and using the menu to choose copy path. I’ll edit the original comment. – dennitzio Mar 10 at 16:48
0

An easier method for sending links would be this:

  1. You copy and paste the path of the folder from the "Get Info" dialog where you are getting your folder path screenshot. If you highlight the path like so:

    enter image description here

    You can copy the path using Edit > Copy or Command+C.

  2. Paste the path into the email using Edit > Paste or Command+V

  3. Make the path a link - this will vary between email clients. As the link address, put in the file path.

  4. When your coworker gets it, they click the link in the email and it should open the folder in Finder (assuming they have the SMB server currently connected).

This worked for me on El Capitan with Outlook as a mail client.

  • This will fail if the path has spaces. smb://example.com/very important file would end up as a broken link to smb://example.com/very – joemaller Sep 15 '16 at 4:38
  • It works fine for me if it has spaces - that might be an email client difference (like I said I'm using Outlook). An alternative to try is replacing spaces with "%20", as in smb://example.com/very%20important%20file - this is URL space encoding and also works for me in Outlook. – Testing Sep 15 '16 at 14:39
  • Unfortunately, this doesn't happen in Apple Mail, and we cannot requires users to manually encode special characters. – Wowfunhappy Sep 15 '16 at 19:17
0

My go to tool for this is a Finder extension available on the Mac App Store:

It's super helpful for all sorts of common gyrations whether you need to convert between the Apple syntax or windows syntax for a share and is super speedy for getting a link you can paste if that's all you need.

0

I ended up writing an Automator Quick Action / Service for this:

https://github.com/ideasonpurpose/NAS-Location-Sharing-Workflow

A small amount of configuration will be required, to specify e.g. the server address address of your nas drive(s). Details are in the repository readme.

We have been making very heavy use of this within my company for nearly a year now, and it has been great. The key thing to makes it work is that we have code (an automator service) to handle both ends—both the sharing of paths and the opening of received paths. File:// and SMB:// links proved much too unreliable; different programs treat them differently.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .