14,000 hints and counting!

A script to convert and mount Windows server paths
I work in a Windows-dominant environment, and am annoyed at always getting 'links' in emails that are really Windows filepaths, like this one:
\server\share\point\path\to\file or folder
These usually have spaces in them, and can point to either a file or a folder. So I created a small Perl script to take a string from the clipboard, mount the correct sharepoint (if necessary), and then open the directory or file to which the original path points:
#!/usr/bin/perl

$smburl = pbpaste;$smburl =~ s"\n" "g;
if ($smburl =~ m"^\\\\([^\\]*)\\([^\\]*)\\(.*)") { my ($server, $share,$path) = ($1,$2, $3); if (! -d "/Volumes/$share/") {
system("osascript -e 'mount volume \"smb://$server/$share\"'");
}
$path =~ s"\s*$"";
$path =~ s"\\"\/"g;$path =~ s"\s"\\ "g;
system("open /Volumes/$share/$path");
}
After creating this, I wrapped the application up with Platypus. Now when I get a Windows path in email, I select it, copy it, and use LaunchBar to open my ConvertServerPath application.
•
• Currently 3.00 / 5
• 1
• 2
• 3
• 4
• 5

[12,261 views]

## Hint Options

A script to convert and mount Windows server paths | 4 comments | Create New Account
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A script to convert and mount Windows server paths
Authored by: aylwinndp on Apr 04, '05 11:33:04AM

I'd love to see the converse of this... How to convert a Mac path to Windows, since I often have to send file locations to Windows-based coworkers.

A script to convert and mount Windows server paths
Authored by: cbt on Apr 04, '05 01:15:36PM

Here are a few of my applescripts. One droplet is called "copy unix paths" and could be tweaked into returning a PC path. Not sure how to get the name of the server, though:

http://putnamhill.net/codeshop/applescript/applescript_utils.dmg

--
Cole

A script to convert and mount Windows server paths
Authored by: oliverlangan on Apr 04, '05 12:58:54PM

The original post should have had the example with TWO backslashes at the front, e.g.,

\\server\share\path\to\file

A script to convert and mount Windows server paths
Authored by: metafeather on Apr 05, '05 10:43:31AM

It's also worth having a look as WinShortCutter, for when you are sent or come across .lnk files on Windows servers:

http://www.lobotomo.com/products/WinShortcutter/index.html