bloomonkey/oai-harvest — pull request #5 by ulikoehler (2013-08-29 12:03:58+00:00)
Title: Create target subdirs if they don't exist

I tried to harvest the arXiv metadata, but it failed because it was trying to open a file in a subdirectory that did not exist.

This changes the directory creation behaviour to *mkdir -p* all dirs in *os.path.dirname(fp)*.

Additionally, it partially works around the problem that the user might use an existing file as *-d* argument or a target dir might already exist as file (now *os.path.isdir()* is used instead of *os.path.exists()* is used).