Skip to content

Instantly share code, notes, and snippets.

@rjungemann
Created January 30, 2010 22:13
Show Gist options
  • Save rjungemann/290749 to your computer and use it in GitHub Desktop.
Save rjungemann/290749 to your computer and use it in GitHub Desktop.
Retrieve a filename from a URL
# retrieve a filename from a URL
require 'uri'
url = "http://threeve.org/blog/2008/01/run-ruby-script-automator-action.html"
uri = Uri.parse(url)
basename = File.basename(uri.path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment