If you’ve ever wanted to know how to FTP a file to a remote server via a right-click context menu in OS X, then continuing reading! As a bonus, I’ll add a desktop notification once the upload is completed.
What you will need:
- Mac OS X
- Remote FTP server, and client
- Ruby (for desktop notification via terminal-notifier)
ProcedureThe first thing you want to do is install the terminal-notifier so you can receive desktop alerts after your upload is completed. Ensure you have Ruby installed, and then run the install command from Terminal.
sudo gem install terminal-notifier
Next, make sure your have a remote directory to upload your files too. I used FileZilla as my FTP client to create a remote directory on my website http://www.corcornap.com, named “shared”. I won’t go in depth into creating remote directories on FTP servers. If you need me to, please comment below.
Next, we use Automator to create a shell script that we can use to upload our files to our newly create FTP directory. In your Applications folder, open the Automator App. Select the ‘Service’ as your document type.
Under ‘Actions’ look for the ‘Run Shell Script’ option (alternatively you can use the search box to type in ‘run shell script’). In the script editor drop down the ‘Service receives selected’ menu and select “file and folders”
In the ‘Run Shell Script’ editor paste the following script:
for f in "$@"
printf "Uploading file: $f \n FILENAMED: $fileName \n\n"
curl -u [username]:[password] “ftp://[your ftp site]/[directory]/$fileName" -T "$f"
terminal-notifier -message "Upload of $f to FTP completed" -title "Upload Status" -open "http://[your ftp site]/[directory]/$fileName"
Replace the following text with your own:
- [username] : your FTP site’s user id
- [password] : your FTP site’s password
- [your ftp site] : your FTP site’s URL
- [directory] : the folder path you plan on uploading files too
Thanks to the following sites I used for reference: