Yahoo provides downloadable historical quote data if you exercise a properly formatted URL. The data is returned in CSV format and is easily stored in a file. I wrote quote-downloader to accept stock symbols from the command line and request and store the data in symbol.csv files locally.
The program demonstrates reading from the command line, building a unique URL and reading from it as well as saving the results to a file and
The code is on github here https://github.com/bradlucas/quote-downloader