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

10.4: See where Safari downloads originated Web Browsers
Tiger only hintA little nicety I noticed when getting info on a disk image on my desktop this morning. There is now a "Where from:" field under More Info when I download a file from Safari. I don't know if this was there in Panther but I know utilities exist to add this feature. Just a note though, if Safari automatically opens the fie to say, mount the image or unzip a zip, then the resuliting folder or file does not have the where from field.

[robg adds: This field is used by Spotlight; the 'raw' name of the field is kMDItemWhereFroms, which you can see in the list of all possible Spotlight metadata (mdimport -A).]
    •    
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[14,910 views]  

10.4: See where Safari downloads originated | 14 comments | Create New Account
Click here to return to the '10.4: See where Safari downloads originated' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: See where Safari downloads originated
Authored by: oculos on May 28, '05 11:29:53AM

I remember this was a feature of MacOS 9, or even previous releases, that disappeared with OS X. On the comments field of a get-info, there was the link where the file came from. That's how i remember it, and I'm glad it came back now.



[ Reply to This | # ]
10.4: See where Safari downloads originated
Authored by: snit on May 28, '05 02:59:50PM

OS 9 used to add the origin to the comments when you dragged and dropped an image to the desktop - OS X still does not do that. I wish it did. Still, good to know the functionality is at least partially back.



[ Reply to This | # ]
10.4: See where Safari downloads originated
Authored by: Shatner on May 29, '05 07:12:55AM

It wasn't the OS that was doing it, it was Internet Explorer, which saved the originating URL in the Finder comment field. In fact, I believe the OS X version of Internet Explorer still does this.



[ Reply to This | # ]
10.4: See where Safari downloads originated
Authored by: legacyb4 on May 28, '05 12:59:31PM

Get Info also now shows EXIF data from photos downloaded (if present in the original image data).

Nice!



[ Reply to This | # ]
10.4: See where Safari downloads originated
Authored by: fud on May 28, '05 01:36:14PM

Does anyone know how to copy the text in the "where from" field? It would be much more usefull if this information didn't have to be manually retyped when needed. I still used DownloadComment, which puts the download url in the comments field, http://www.ecamm.com/mac/free/.



[ Reply to This | # ]
10.4: See where Safari downloads originated
Authored by: simonpie on May 28, '05 02:43:57PM
You can always use mdls on the file to retrieve all the metadata.

[ Reply to This | # ]
10.4: See where Safari downloads originated
Authored by: baltwo on May 28, '05 03:22:28PM

I just did a CMD + I on a .hqx file I downloaded. Under Spotlight Comments the download path was selectable and I copied it into TextEdit without any problem. If you select TextEdit->Format->Text->Link…, you can paste the selection into the dialog box and TextEdit will make it a clickable link.



[ Reply to This | # ]
10.4: See where Safari downloads originated
Authored by: zane on May 29, '05 04:27:22PM

Not for me. I had a "Where From" entry in Get Info, but nothing in Spotlight Comments. Shame, without copy/paste services, long "Where From" entries are laborious to re-type! ;)



[ Reply to This | # ]
10.4: See where Safari downloads originated
Authored by: freerangehuman on May 28, '05 07:06:31PM

If the download is still in your Safari download window, you can also get its address by ctrl-clicking and selecting Copy Address. I couldn't do that before in Jaguar, although it might have been available in Panther, I don't know.



[ Reply to This | # ]
10.4: See where Safari downloads originated
Authored by: zane on May 29, '05 04:29:03PM

From what I can tell, "Where From" doesn't appear in files the are "manually" downloaded by right/control-click or drag-n-drop. I might have to try out that "DownloadComment" app linked above. ;)



[ Reply to This | # ]
10.4: See where Safari downloads originated
Authored by: fractacular on Jun 17, '05 11:13:01AM
This hint describes how Safari stores the URL of a download in the file's metadata. However, it neglects to mention that you can't copy the information when you get info in the Finder -- how rude!
I wrote a short shell script which displays all the URLs Safari stores in the "Where from" field (more than one URL, sometimes, it seems), and copies the first one to the clipboard. As a scripting novice, I welcome suggestions.

geturl.sh:

#!/bin/sh
# Gets the stored URL(s) of a file you downloaded, 
# prints out all of the metadata it gets
# and copies (to the clipboard) the first URL in the series
mdls -name kMDItemWhereFroms $1 | cut -s -d \" -f2 | head -n1 | pbcopy
mdls -name kMDItemWhereFroms $1 | cut -s -d \" -f2 

Once you've saved this in a file and made it runnable:
chmod 755 geturl.sh
run it on any downloaded file:
geturl Desktop/mydownload.foo


[ Reply to This | # ]
10.4: See where Safari downloads originated
Authored by: SteveJ098 on Jan 09, '10 09:22:19PM

This loop will process multiple files, print the URL's to the tty and save to the pastebuffer
(Quoting of $@ and $f is very important):

#!/bin/sh

for f in "$@"
do
mdls -name kMDItemWhereFroms "$f"|cut -s -f2 -d\"
done |\
tee /dev/tty|\
pbcopy



[ Reply to This | # ]
10.4: See where Safari downloads originated
Authored by: dave1212 on Jul 28, '05 01:56:04PM

It's not a persistent thing though, so if you copy that file somewhere else (say, a different partition) and the delete the original, there will be no record of which URL it came from. This sucks for me, as I keep most of my stuff on other partitions, but download to a folder on my desktop.

Any chance an AppleScript whiz can set us up with one that copies the URL to the comments field or something? It's really annoying that the info doesn't stay with the file.

---
______
http://www.macskill.com/



[ Reply to This | # ]
Set Comment to "Where From" URI.scpt
Authored by: Rainy Day on May 14, '08 07:06:52PM
Save this script into Library/Scripts/Applications/Finder/ and you can easily invoke it from the Finder via the Script Menulet. Works on the frontmost window. Works on either a Get Info window, or a Finder window with one or more selected files:

tell application "Finder"
	if the class of window 1 is information window then -- If a Get Info window
		fetchWherefromData(item of window 1 as alias, true) of me
	else if the class of window 1 is Finder window then -- If a regular Finder window
		repeat with thisItem in the selection as list -- may have multiple files selected
			fetchWherefromData(thisItem as alias, true) of me
		end repeat
	end if
end tell
beep

(*  Grab the WhereFrom metadata; If "setComment" is true, put it into the file's comment box  *)
on fetchWherefromData(theFile, setComment)
	set theURI to do shell script "mdls -name kMDItemWhereFroms " & quoted form of POSIX path of theFile & " | perl -ne 'print if s/.*"(.*)".*$/\1/'" --  shell script to fetch metadata; using Perl to extract URI from mdls's messy output
	if setComment = true then -- Put it into the file's comment box?
		if theURI ≠ "" then -- did we get a URI?
			tell application "Finder"
				set theComment to comment of theFile
				if theComment = "" then -- if no comment exists, put in the URI
					set comment of theFile to theURI
				else if theComment ≠ theURI then -- if the comment is the URI, do nothing, else append the URI to the end of the comment
					set comment of theFile to theComment & return & theURI
				end if
			end tell
		end if
	end if
	return theURI
end fetchWherefromData


[ Reply to This | # ]