hasseg.org

Going Back to the Origin of a Downloaded File

Filed under Mac, Scripts

goToSource icon One of the biggest reasons why I prefer to use Safari as my web browser of choice on OS X is its integration with the rest of the operating system, a quite recent example of which is the tagging of downloaded files with Spotlight metadata about the location where they were downloaded from. In the latest Safari update – version 3.1 – this was extended to also apply to pictures dragged from the browser onto the local filesystem.

This metadata is most frequently used in the dialogs that are shown whenever an executable is being opened for the first time after being downloaded from the web, and it is accessible to users via the "get info" dialog box. If you have a file laying around somewhere, and you're trying to remember where you got it from, you can always look at the file info, find the "where from:" field, copy the address, switch to your browser, paste the address to the location bar, and press enter in order to get to the origin site. I knew you could read file metadata in OS X with the mdls utility, so I figured it'd be quite simple to make a little "droplet" application for streamlining the task of navigating to the origin web site of a particular file, so that's exactly what I did.

To use the application, simply drag and drop any file on top of it. If the file has a metadata field about the location where it was downloaded from, that address will be opened in your default web browser. If there are several locations listed in the metadata, a dialog box will pop up to ask you to choose which one to navigate to. It will also confirm whether to go to the address or not if it looks like it's a direct link to download the file itself.

The links to download the application and/or its source code are below. It is basically a Python script made into an application with Platypus, and it's using CocoaDialog for the popup dialogs.

goToSource icon

 

Categories