#!/usr/local/bin/python """ mkoldlinks - Given a tree with an "old-style" spunk distribution and a database of new locations remove the datafiles and replaces them with links to the new files. """ import sys import os import dbm import regex import string DIR="anarchy_texts" DATABASE="indexdb" MATCHPROG=regex.compile("Spunk\([0-9][0-9][0-9]\)\..*") IGNORE=[".", "..", "Index.txt"] def main(): dict = dbm.open(DATABASE, 'r') os.mkdir('All', 0755) os.chdir('All') for i in dict.keys(): src = dict[i] dst = os.path.split(src)[1] print dst, src os.symlink(os.path.join('..', src), dst) main()