I had the requirement to automate an FTP upload task on my Mac. Basically, there was one single HTML file I was editing & uploading frequently, and I was tired of using an app for that. I needed a faster solution.
Which I did. I’m sharing my solution which could help others as well.
First of all, create a new text file. It should contain the following command (case-sensitive):
curl -T /local_path/file.html -u ftp_user:ftp_pass ftp://ftp.blabla.com/ftp_path/file.html
Obviously, you need to replace the sample values with real ones. Afterwards, you should rename the file so that it should have the extension .command . ftp_upload.command would be a good example.
As the last step, you need to enable the execution authorization for this file. Enter terminal, browse the path your file resides, and type the following command:
chmod +x ftp_upload.command
Voila! From now on, you can upload the file simply by double-clicking ftp_upload.command . This saved me a lot of time.
The risk of this approach is, you are storing your FTP password in a plain text file. Therefore, you might want to set the authorization of the file so that only your user is able to read it.
For more advanced requirements, you can consider purchasing an FTP client with AppleScript support, and develop your own workflow / script targeting the client.
Leave a Reply