Bash Command Line Interface for the Zamzar API - convert files to 100s of formats direct from the command line.
Shell
Latest commit 03ada41 Feb 3, 2015 @louismrose louismrose Fix #3. Convert source files with double spaces in their filename.
Previously, the default internal field separator (IFS) was being used. This is "<space><tab><newline>" and 2 or more repeated characters was reduce to a single separator during substitutions. To fix this, IFS is now cleared before making any substitutions that involve filenames. (Filenames can contain any character so there are no safe characters to use as the IFS).
Permalink
Failed to load latest commit information.
AUTHORS.md Initial commit Jan 21, 2015
CHANGES.md
LICENSE Initial commit Jan 21, 2015
README.md More documentation on saving to an alternate directory Jan 27, 2015
zamzar.sh

README.md

Introduction

This repository provides a simple Bash Command Line program (zamzar.sh) for using the REST-based Zamzar file conversion API. It has been tested on OSX but should also work with cygwin (on Windows) and Linux since it uses standard Bash conventions.

You will need to have cURL installed on your system to use this script.

If you find any issues please raise them against this repository, since it is monitored by the Zamzar development team. We welcome pull requests and suggestions for improvements. The code in this repository is MIT licensed.

Installation

Usage

  • To find out what "to" formats are available for conversion for a given input file:

    ./zamzar.sh ~/portrait.jpg
    

    … should output:

    - bmp (1 credits)
    - gif (1 credits)
    - ico (1 credits)
    - pcx (1 credits)
    - pdf (1 credits)
    - png (1 credits)        
    - ps (1 credits)
    - tga (1 credits)
    - thumbnail (1 credits)
    - tiff (1 credits)
    - wbmp (1 credits)
    - webp (1 credits)
    
  • To convert a file into a different format and automatically download and save it to your current working directory with the same name and the file extension of the converted format:

    ./zamzar.sh ~/portrait.jpg png
    

    … should output:

    Job 313 is successful
    Downloading converted file(s) for job 313
    Converted file (id #2870) saved to: portrait.png
    
  • To convert a file into a different format and automatically download and save it to a different directory:

    ./zamzar.sh ~/portrait.jpg png ~/Downloads/
    
  • To print out the version of the script being used:

    ./zamzar.sh -v
    
  • To run a conversion in "debug" mode (useful for examining the cURL commands being run under the covers):

    ./zamzar.sh -d ~/portrait.jpg png
    

Further Reading

If you want to browse all the formats you can convert "from" and "to" using the Zamzar API then check out https://developers.zamzar.com/formats

If you want to extend this script to perform more advanced functions why not take a look at our comprehensive documentation which gives information on other operations and endpoints available in the API.