Skip to content

Instantly share code, notes, and snippets.

@bytespider
Last active December 16, 2015 18:58
Show Gist options
  • Save bytespider/5481240 to your computer and use it in GitHub Desktop.
Save bytespider/5481240 to your computer and use it in GitHub Desktop.
Serve a folder with Python SimpleHTTPServer
on run
tell application "Finder"
if selection is {} then
set finderSelection to quoted form of POSIX path of (folder of the front window as string)
else
set sel to (first item of (selection as list))
if class of sel is folder then
set finderSelection to quoted form of POSIX path of (sel as string)
else
set finderSelection to quoted form of POSIX path of ((container of sel) as string)
end if
end if
end tell
tell application "Terminal"
activate
do script "cd " & finderSelection & "; python -m SimpleHTTPServer 8080;"
end tell
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment