I wasn't clear - I am writing a lot of code on my sandbox, and I use the Developer Console for that.
I want to export all the classes and Triggers I write, for backup. Using Meta API - I am not looking to export a single document/file.
[WAS:I want to keep a backup of my entire APEX codes (classeses, triggers, etc) Is it possible? and if so, how?}
Attribution to: Saariko
Possible Suggestion/Solution #1
You can use the Meta-data API for these purposes. We do so at work quite often.
There are two channels we adopt, basically both the same, but using different IDEs (Force.com IDE and SublimeText/MavensMate). Here I will explain how to do this using the Force.com IDE (available from the Eclipse foundation, instructions here) and install it on your machine, you can then create a new "project" in it, which will suck-down all your files (Apex) and any selected Meta-data.
To create a new project in the IDE, you will need your username and password, and security token (available from "My settings" in the interface) and then fill in the "New Force.com Project" form.
Once you have connected to the project, you can add/remove meta data components (including Apex Classes and Apex Triggers) and click "ok". This process can take quite a while, but it will pull all your classes and data down to the local machine.
You will see them all listed in the file navigator on the left.
You can find the exact location of the files by right clicking on the project name on the left and selecting "Properties" and then "Resource" - this will lead you through to the location of the folder on your PC and you can Zip/Copy save them away.
There are also a number of version control plugins for the Force.com IDE such as SVN and CVS which will allow you to archive and manage your data and classes as well.
Attribution to: Simon Lawrence
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/32380