Monday, August 25, 2014

Copy path of file on SMB share on a Mac and convert to Windows format using Automator

I'm on a Mac. Most of my co-workers are on PCs. We store files on a network attached storage device that 'talks' Samba. I like to send links to files via email (instead of the file itself). So I need a quick way to convert the Mac/Linux file path format to the Windows format. I couldn't find it easily, and it took me several tries, so I thought I'd post the way to do it.

1) Have one of your PC colleagues send you a link to a file on the shared storage device.  It'll look something like: \\companyname.com\storage\depts\org_chart.doc

2) Then look at the way that same file appears to you via terminal. Probably something like:
/Volumes/depts/org_chart.doc

So, you need to substitute Volumes with companyname.com\storage, and then flip the forward slashes with backslashes.

3) Open Automator. 

4) Click "New Document"

5) Choose "Service"

6) Have your Automator Window look like this (but replace insert PC path with forward slashes with company name.com/storage):

7) Save it to something like "Copy Windows Path"


Now let's test it.

8) Use your Finder to go to the file. Control-Click (or two-finger tap) on the file, select Service, Copy Windows Path"

9) Paste it into an email.

Yay! You've made Windows users happy. Well, as happy as they could be... ;-)

No comments:

Post a Comment