Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

One way to share links to networked files Network
Problem: You work with 50 people using Macs, and you need to direct someone to a file on the server which is buried 12 layers deep in the folder hierarchy. Unlike the web, OS X provides no way to "bookmark" a file.

Solution:
  1. Drag the file into an empty Firefox window.
  2. Copy and paste the file path from Firefox's address bar.
  3. Share by email, iChat, or whatever.
Comment: This is the most elegant solution -- and it's far from that -- that I can find. It seems absurd the Finder can't do this. We waste thousands of man hours per year because there's no easy way to share locations of files on our server; that seems as sensible as the web without hyperlinks! If you have alternative solutions, please share them in the comments.
    •    
  • Currently 1.82 / 5
  You rated: 1 / 5 (11 votes cast)
 
[24,987 views]  

One way to share links to networked files | 34 comments | Create New Account
Click here to return to the 'One way to share links to networked files' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
One way to share links to networked files
Authored by: macHobbes on Mar 23, '09 07:43:33AM

I can not check it right away, but what about
- mailing an alias to that file?
- attaching a unique spotlight comment, so that you can search for it on your servers?



[ Reply to This | # ]
FilePathToClip CM Plugin
Authored by: haralds on Mar 23, '09 07:45:18AM
Another option is to use a Contextual Menu Plugin to be found here:
http://www.hsoi.com/hsoishop/software/


[ Reply to This | # ]
PathFinder
Authored by: CBStephenson on Mar 23, '09 08:02:48AM
PathFinder (from Cocoatech) has a Copy Path command in the Edit menu that will do exactly what is required here--as in so many cases where the Finder just doesn't do something you need it to do.

PathFinder is inexpensive (but not free), and offers a lot of power to Mac users with advanced needs. I have no personal connection except as a satisfied user.

www.cocoatech.com

[ Reply to This | # ]
One way to share links to networked files
Authored by: Sesquipedalian on Mar 23, '09 08:08:18AM

I use Quicksilver, so all I would need to do is select the file in Quicksilver, run the Get File URL action, and then run the Paste action. VoilĂ , a proper link is pasted.

Also, getting the file path is not sufficient for the original poster's purposes. He wants a clickable link, so he need the file URL. A file path looks like /Volumes/server1/path/to/file. A file URL (for a file on a mounted network volume) looks like file://localhost/Volumes/server1/path/to/file



[ Reply to This | # ]
One way to share links to networked files
Authored by: palahala on Mar 23, '09 08:12:15AM

Not really easier, but Mail does seem to provide some support:

In Mail, while composing a message, choose Edit, Link, Add. Next, drag any file into the popup (you can also drag a proxy-icon from a window's title bar into that box). Finally, manually type "file://" in front of the URL (commonly yielding a total of 3 slashes, including the first slash of the path you've dragged into the popup).



[ Reply to This | # ]
One way to share links to networked files
Authored by: giulio on Mar 23, '09 08:16:41AM

Can you create an alias to your desktop, then send that alias?

---
Freelance web development
WebVeteran.com



[ Reply to This | # ]
One way to share links to networked files
Authored by: Panjandrum on Mar 23, '09 08:10:19PM

Yes, you can. At least, this has worked in all the network environments I've worked in, but those have always been 100% Mac networks. I expect things will get complicated quickly if this isn't the case. I also run static IP addresses on all my servers, further simplifying things. So while this has always worked properly for me, it probably doesn't work in many situations (I expect we wouldn't see this hint here if the "just make an alias" method worked for everyone).

But for those looking for a simple solution, you can certainly try this method. Simply make an alias to the folder or file you wish. Then distribute that alias. Some software won't directly distribute an alias (following the alias instead). In such cases simply zip up the alias and send the zipped copy.



[ Reply to This | # ]
One way to share links to networked files
Authored by: chleuasme on Mar 23, '09 08:18:36AM
Unlike the web, OS X provides no way to "bookmark" a file.
Ever heard about .fileloc files?

[ Reply to This | # ]
One way to share links to networked files
Authored by: chleuasme on Mar 23, '09 09:32:13AM
An example script that (should) create .fileloc files of selected items in the finder (ideally place this as an application in Finder's window toolbar) :
set fileloc_begin to "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
	<key>URL</key>
	<string>file://"

set fileloc_end to "</string>
</dict>
</plist>"

set cmd_txt to (quoted form of fileloc_begin) & "$furl" & (quoted form of fileloc_end)


tell application "Finder"
	set elts to get selection
	repeat with elt in elts
		set f to POSIX path of (elt as string)
		set fn to name of elt
		set p to POSIX path of ((container of elt) as string)
		set furl to do shell script "/bin/echo -n " & f & " | ruby -ruri -p -e '$_=URI.encode$_'"
		set fileloc to quoted form of (p & fn & ".fileloc")
		do shell script "furl=" & furl & "; echo " & cmd_txt & " > " & fileloc
	end repeat
end tell
(note I'm not an expert in Applescript, so use at your own risk)

[ Reply to This | # ]
One way to share links to networked files
Authored by: michaelj on Mar 23, '09 09:53:17AM
I've used this cm module for years - PathSnagger from BergenStreet Software - http://www.bergenstreetsoftware.com/

[ Reply to This | # ]
One way to share links to networked files
Authored by: chleuasme on Mar 23, '09 12:41:08PM

Your post must be mistakenly placed as an answer to my applescript. Reading the description of this software, I can't see anthing related to what the script does: create a .fileloc file for every selected file or folder in the Finder (... with a bug for files contained in a folder whose name includes the char '/').



[ Reply to This | # ]
One way to share links to networked files
Authored by: Uncle Asad on Mar 23, '09 02:18:16PM
Once you get your file:// URI (filepath) and name (filename) set up, you can just use the following tell block instead of writing the plist skeleton yourself:
tell application "Finder"
	make new internet location file at desktop to ¬
		filepath with properties {name:filename}
end tell
Saves a lot of code and lets the Finder do all the heavy lifting.

[ Reply to This | # ]
One way to share links to networked files
Authored by: chleuasme on Mar 23, '09 04:08:58PM
Thanks!

If it can helps, I then give the new version of the two scripts

  • create .fileloc file for the selected items of the Finder:
    tell application "Finder"
    	repeat with elt in (get selection)
    		set filepath to POSIX path of (elt as string)
    		set filename to name of elt
    		set parentdir to container of elt
    		set fileurl to do shell script "/bin/echo -n file://" & filepath & " | ruby -ruri -p -e '$_=URI.encode$_'"
    		
    		make new internet location file at parentdir to fileurl with properties {name:filename}
    	end repeat
    end tell
    
  • create .afploc file for the selected items of the Finder:
    tell application "Finder"
    	repeat with elt in (get selection)
    		set filepath to do shell script "echo " & (POSIX path of (elt as string)) & " | sed 's:^/Volumes::'"
    		set filename to name of elt
    		set parentdir to container of elt
    		set s to text returned of (display dialog "Enter the afp server for " & filepath default answer "afp://")
    		set afpurl to s & (do shell script "/bin/echo -n " & filepath & " | ruby -ruri -p -e '$_=URI.encode$_'")
    		
    		make new internet location file at parentdir to afpurl with properties {name:filename}
    	end repeat
    end tell


[ Reply to This | # ]
One way to share links to networked files
Authored by: Spartacus on Mar 23, '09 08:37:24AM
What about this script, if you have to do it often? Save it as an application and drag it to the top of a Finder window.
(* I am hereby making it clear that this code was descended from Apple sample code, but that I've made changes. *)

tell application "Finder"
	set the item_list to selection
	if (count of item_list) is 0 then
		try
			set the item_list to {(folder of the front window) as alias}
		on error
			set the item_list to {path to desktop folder as alias}
		end try
	end if
end tell

set urls to ""
repeat with this_item in item_list
	tell application "Finder" to set this_url to URL of this_item
	set urls to urls & this_url & return
end repeat

set the clipboard to (urls as text)


[ Reply to This | # ]
One way to share links to networked files
Authored by: Sea Prompt on Mar 23, '09 08:37:52AM

I've gotten the path before by dragging the file or folder onto Terminal, and then copying and pasting it. Not sure if I was able to drag directly onto TextMate. TextEdit just embeds the file.



[ Reply to This | # ]
One way to share links to networked files
Authored by: MJCube on Mar 23, '09 08:50:19AM

I usually use SuperGetInfo to copy a file's full path.



[ Reply to This | # ]
One way to share links to networked files
Authored by: thegooch49 on Mar 23, '09 09:10:07AM

You can also drag a file onto the spotlight window in the finder. That will enter the file path, that you can copy to your clipboard. It's super quick when you just drag a file, hit command + <spacebar> and drop the file here, then copy path to clipboard.



[ Reply to This | # ]
One way to share links to networked files
Authored by: ctierney on Mar 23, '09 09:31:34AM
Here's an applescript that I use to shared paths with coworkers on our lan:
http://putnamhill.net/applescript/copy-unix-paths


[ Reply to This | # ]
One way to share links to networked files
Authored by: timcrawf on Mar 23, '09 11:30:07AM

I tried many of these suggestions, and while it give a url, what it gave me was one based on a local file system, e.g. file://localhost/Volumes/SharedDocs/DaveSD.JPG
this only works if the shared volume is already mounted. I would like a way to do it like "the other guys" where it actually tries to mount the volume if necessary.
something like afp://192.168.5.8/Shared/goodstuff/file.jpg
this should then work for anyone in the organization.



[ Reply to This | # ]
One way to share links to networked files
Authored by: ctierney on Mar 23, '09 12:54:50PM
If you don't mind assuming the protocol and host you use something like the following:
http://putnamhill.net/applescript/copy-afp-paths

Or this for a windows share:
http://putnamhill.net/applescript/copy-unc-paths

Looks like you could extract the protocol from the mount command if you want to get fancy.

[ Reply to This | # ]
One way to share links to networked files
Authored by: CyberSkull on Mar 23, '09 11:30:58AM
I have Bare Bone's Super Get Info, and it has an option to copy to the clipboard either the HFS or POSIX path to a file. You could also drag a file into the Terminal window too.

[ Reply to This | # ]
One way to share links to networked files
Authored by: blumenberg on Mar 23, '09 12:38:28PM

Mmh, mixed results -- I did the following things:

A) to get the filepath like:
"/Volumes/VOLUMENAME/FOLDERNAME/FILENAME"

  1. AppleScript from "ctierney": works besides "Umlaute" are garbled
  2. AppleScript from "Spartacus": no need for a list of files
  3. drag'n'drop file to a TextMate document: works besides "Umlaute" are garbled
  4. drag'n'drop file to a Terminal window: works besides spaces get escaped
  5. Contextual Menu like "haralds" (FilePathToClipCMPlugin.plugin) or FileUtilsCM.plugin w/ "copy file path": works perfect
  6. drag'n'drop file to Spotlight window ("thegooch49" tip): works perfect
and

copy the previous copied filepath to a highlighted word via "Menu > Format > Link…" in TextEdit or Mail and add in front of the filepath "file://" -- this "linked" text is draggable to the finder and becomes a ".fileloc" file

B) or better:
"file:///Volumes/VOLUMENAME/FOLDERNAME/FILENAME"

  1. drag'n'drop file (rtf) to Firefox window : Firefox ask for download
  2. drag'n'drop folder to Firefox window : Firefox shows list/index of folder -- files and folders are links

C) or best:
"afp://BONJOURSERVERNAME.local/Volumes/VOLUMENAME/FOLDERNAME/FILENAME"

  • no readymade solution - besides:

D) combine the spotlight or the Contextual Menu tip w/ TextExpander like: prepare a snippet like "file://" (I used "flx") -- or for the additional function to mount an unmounted volume: "afp://BONJOURSERVERNAME.local" -- and put it together in Mail ("Add Link…") or TextEdit (see A))

Thinking: I'm sure there is someone who can build an AppleScript -- maybe with a dialogue -- to make this even easier



[ Reply to This | # ]
One way to share links to networked files
Authored by: chleuasme on Mar 23, '09 01:02:33PM

For the manual creation of .fileloc file you described in A, you can simply drag the file or folder to the text box of the dialog for link creation (in TextEdit, Mail, ...) and add the prefix "file://". Another solution is to drag to a Finder window the content of the Firefox's adress bar after the drag of a file or folder. The Applescript I wrote above may be an easier solution, though ;-)



[ Reply to This | # ]
One way to share links to networked files
Authored by: chleuasme on Mar 23, '09 02:02:16PM
To create .afploc files, i propose this Applescript :
set afploc_begin to "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
	<key>URL</key>
	<string>"

set afploc_end to "</string>
</dict>
</plist>"

set cmd_txt to (quoted form of afploc_begin) & "$afpurl" & (quoted form of afploc_end)


tell application "Finder"
	set elts to get selection
	repeat with elt in elts
		set f to POSIX path of (elt as string)
		set fn to name of elt
		set p to POSIX path of ((container of elt) as string)
		set afploc to quoted form of (p & fn & ".afploc")
		set s to text returned of (display dialog "Enter the server for " & f default answer "afp://")
		set afpurl to s & (do shell script "/bin/echo -n " & f & " | ruby -ruri -p -e '$_=URI.encode$_' | sed 's:^/Volumes::'")
		
		do shell script "afpurl=" & afpurl & "; echo " & cmd_txt & " > " & afploc
	end repeat
end tell
(again, use at your own risk, with same problems on files or folder with a name containing the character '/')

I don't know a way to obtain the afp server given a mount point, to avoid the dialog.

[ Reply to This | # ]

One way to share links to networked files
Authored by: ctierney on Mar 23, '09 07:17:01PM
This version may preserve Umlaute:
http://putnamhill.net/applescript/copy-unix-paths

[ Reply to This | # ]
One way to share links to networked files
Authored by: blumenberg on Mar 24, '09 05:44:53AM

yes, it's working. thanks for the "umlaut" modification.



[ Reply to This | # ]
Bookmarking a file in Finder is easy.
Authored by: wusamah on Mar 23, '09 12:54:41PM
Getting the file path is one thing but to make a bookmark in the Finder is possible and a lot easier than you think. At least for 10.5 Leopard.

Drag a file onto the toolbar of your Finder window. The cursor will show a green plus icon. Then release your mouse. The icon will now be a clickable button on the Finder window. And you can drop anything you like, even a link to a folder.

the image example i linked to below, take a look at the icons left of the spotlight fields.

http://img113.imageshack.us/img113/9522/finderbookmark.jpg

[ Reply to This | # ]
Bookmarking a file in Finder is easy.
Authored by: wusamah on Mar 23, '09 01:00:29PM
Ah, sorry link did not work. here's a working version: http://img201.imageshack.us/img201/9522/finderbookmark.jpg

[ Reply to This | # ]
One way to share links to networked files
Authored by: hamarkus on Mar 23, '09 01:49:10PM
There is a control panel named WinShortcutter (http://www.lobotomo.com/products/WinShortcutter/index.html), unfortunately I did not get it to work on my network.

[ Reply to This | # ]
One way to share links to networked files
Authored by: timcrawf on Mar 25, '09 06:58:46AM

This looks like the winner



[ Reply to This | # ]
I take it back. It works great (WinShortCutter that is).
Authored by: hamarkus on Mar 30, '09 11:22:07AM

Just had to replace //G: with \\G:, don't we all love these little differences (well, that phrase makes more sense in German).



[ Reply to This | # ]
One way to share links to networked files
Authored by: Gabs on Mar 24, '09 09:57:28AM

I liked the idea to use Spotlight. Nice - but doesn't work for me. Not to sure about the original tip either - I tried it and Firefox passed the files straight onto whatever normal app would open them (ie Word Doc -> Word). I'm not a big fan of Firefox anymore anyway - and will stick with the easiest way I know of doing this:

Create a new TextEdit set it to plain text mode (hit [Apple]+[Shift]+"T") then drag the file into that window.

Bingo - very little overhead.

AFAIK this works with any text editor (TextWranger, CODA, etc) as well as Terminal. But Terminal will escape spaces)...



[ Reply to This | # ]
One way to share links to networked files
Authored by: AntsPants on Mar 24, '09 06:38:47PM

I've been looking for this for so long, being on a network of 80 Windows machines and 20 Macs, with a Linux/Samba fileserver.

I'd tried CopyPath plugin, with a service created by a friend to open UNC paths, but neither of them worked as i wanted -- the serivce opened UNC paths sporadically, and CopyPath only gave the path as mounted on my machine (instead of the full UNC path).

I installed Winshortcutter, changed the prefs to use backslashes, and this works perfectly for me on 10.5.6.

hamarkus, thanks for the tip!



[ Reply to This | # ]
One way to share links to networked files
Authored by: dayhox on Mar 25, '09 11:28:30AM

Here is a script I created for a client. It gets the file/directory location of a dropped on item and copy's the location to your clipboard/pasteboard.

If you'd rather download a precompiled script you can get it on my website (the cobbler has no shoes)

[link:]http://www.solutionarts.net/freebies/loco.zip

Make yer own(please give credit to code used to SolutionArts)-->

Make a droplet (AppleScript Application)
open Script Editor and paste in this -->

on open theItem
set fileName to POSIX path of theItem
set the clipboard to fileName
end open

on run
display dialog "Drop files and folders on this icon to get the location of the file."
end run

--> Save the file as an application

You can alternatively display the location by calling

display dialog "Copy the field text, then paste:" & return & "The file is located at: " default answer "" & return & fileName & return buttons {"Done"}

in the script above, replacing

set the clipboard to fileName

Hope ya like it.
d



[ Reply to This | # ]