
import os

for root, dirnames, filenames in os.walk('.'):
	if 'ann_morphosyntax.xml' in filenames:
		if 'header.dtd' in filenames:
			os.remove(os.path.join(root, 'header.dtd'))
		if 'NKJP_1M_header.xml' in filenames:
			os.remove(os.path.join(root, 'NKJP_1M_header.xml'))
		relpath = os.path.relpath('.', root)
		os.symlink(os.path.join(relpath, 'header.dtd'), os.path.join(root, 'header.dtd'))
		os.symlink(os.path.join(relpath, 'NKJP_1M_header.xml'), os.path.join(root, 'NKJP_1M_header.xml'))
