Clutter Apocalypse 2004 | Main | Big Cat 'Build a Glossary Entry from Selection'

August 15, 2004

Big Cat (secure) 'Copy to public_html'

Posted by Mike on August 15, 2004 12:01 PM

I'm periodically moving files into my public web space to share with others, which presents a few minor issues:

So I wrote a quick script for the Big Cat Script Menu plugin that takes a file selected by the mouse and copies it to my public_html directory using scp, replacing all the spaces in the name with underscore ("_") characters and copying the URL of the newly copied file to the clipboard for pasting into whatever means I'm using to relate the URL to someone else.

Minor caveats:

--Open this script in a new Script Editor window.

-- copy to public_html by Michael Hall <>
-- For use with the Big Cat Scripts Plugin (
-- copy to the Big Cat "files" folder in ~/Library/Application Support/Big Cat Scripts
-- Also: pretty much depends on having ssh keys set up on the remote server, either without a password, or with some kind of ssh-agent in place.

on main(filelist)
    tell application "Finder"
        repeat with i from 1 to (count of items in filelist)
            -- scrub out the spaces from the file name and replace them with the _ character
            set AppleScript's text item delimiters to " "
            set myname to (the name of item i of filelist)
            set ScrubbedName to every text item in myname
            set AppleScript's text item delimiters to "_"
            set myname to every item of ScrubbedName as string
            -- copy the file over to the sever, replace 'ix:public_html/' to your remote host
            do shell script "scp '" & (POSIX path of item i of filelist) & "' ix:public_html/" & myname
            -- create a variable with the URL of the file on the remote server, replace "" to your remote URL
            set myFile to "" & myname
            -- copy the variable to the clipboard for pasting
            set the clipboard to myFile
        end repeat
    end tell
end main


curse you, michael hall! curse you and your incredibly useful script that requires me to get an ssh agent! gah!

Posted by: gl. [TypeKey Profile Page] at August 15, 2004 8:53 PM