Mathjax javascript librry setup

Linux Open Notebook

FTP & File Transfer Automation

I was looking for an easy way to automate FTP transfers of entire directory structures to make it easy to deploy my static web sites from shell scripts. This can’t be done easily eith FTP, and the GUI-based programs ment I either needed to do some Mac OS X Automator or Applescript. NcFTP came to my rescue!

Using NcFTP

NcFTP is a very old, but very nice set of command line programs that offer a powerful alternative to plain FTP. Here’s what I did:

  • Install NcFTP on Mac OS X. It is not installed by default. I use the HomeBrew package installer system, which I find works better than the alternatives. So:
    1. Install HomeBrew
    2. type brew install ncftp on the command line to install ncftp
  • Now set up NcFTP with “bookmarks” that can be used each time you want to copy files between your local machine and the remote FTP site:
    1. type ncftp -u <username> -p <password> <host-name> to log into your ftp host
    2. create “bookmarks” for the directories you want to upload or download. (NcFTP does not use the ~/.netrc file):
      1. type bookmark in NcFTP after you have logged into your host, and cd’ed to the remote directory you want to use
      2. when prompted, give your bookmark a meaningfull name. Also save the password with the bookmark
      3. type bookmarks in NcFTP to edit the bookmark you created. NcFTP will display a text screen with all your bookmarks and allow you yo edit them.
      4. edit your bookmarks so that they have the correct local and remote directories.
  • Copying a whole directory sub-tree between the local and remote directories now becomes a single command:
    1. to copy a whole directory tree from your local computer to your remote site, it is now as simple as ncftpput -R <bookmark> * *
    2. to get a whole directory tree from the remote site use ncftpget -R srcform-prod * *
  • Read the NcFTP Documentation for more information
  • I used the above ncftpput command in make file I used to build my Octopress site to provide targets to move my generate website to a “test staging” directory, and to my “production” directory on my web hosting provider account.

Mac OS X FTP GUI CLients

I’ve used three clients, all are good:

  • Cyberduck - a good free client that supports FTP, SFTP, WebDav, and a number of cloud storage providers. It has a single window interface, and supports synchonizing directories
  • Transmit - is a very full-featured client, that’s blazingly fast, supports delta-based synchonizing, so it only transmits changed files, and supports FTP, SFTP, WebDav, cloud storage providers. It has a menubar menu for quick access. One really cool feature is that it will mount remote directories as disk images, so you can work with them in the finder or other applications. Its intuitive to use. It is the best of the bunch, but it costs $34
  • FileZilla - is a classic free client that’s been around for a long time. It has a 2 window (local/remote) style of interface. It’s not as intuitive to use as CyberDuck or Transmit. But its the only one that is multi-platform, and it works well

Using Curl

Sample Atlassian Tools REST API Access

Crucible

  • curl --user name:passwd --header "Accept: application/json" https://crucible.forge.avaya.com/rest-service/reviews-v1/filter?project=CR-FA > fa-reviews.json/ - Get all reviews for a project as JSON
  • curl --user name:passwd https://crucible.forge.avaya.com/rest-service/reviews-v1/filter?project=CR-FA > fa-reviews.xml - Get all reviews for a project as XML
  • curl --user name:passwd --header "Accept: application/json" https://crucible.forge.avaya.com/rest-service/reviews-v1/CR-FA-143/ > fa-143.json
  • curl --user name:passwd --header "Accept: application/json" https://crucible.forge.avaya.com/rest-service/reviews-v1/filter/details?project=CR-FA > fa-reviews-details.json - Gets a list of all reviews and all review details for a project. This is a very large file, but has all the information needed to extract the Code Inspection metrics.

Comments