2008年11月16日 星期日

[Python code] Create a subdirectory

import os, shutil
d = case # name of the subdirectory
if os.path.isdir(d): # does d exist?
shutil.rmtree(d) # yes, then remove the old directory
os.mkdir(d) # make a new directory
os.chdir(d) # change to new directory

沒有留言: