#!/opt/local/bin/python2.7
import os
f = open('cp.sh', 'r')
for line in f:
path = os.path.dirname(line)
if not os.path.exists(path):
os.makedirs(path)
http://docs.python.jp/2.6/library/os.html http://docs.python.jp/2/tutorial/inputoutput.html http://docs.python.jp/2/library/os.path.html http://docs.python.jp/2/library/shutil.html