Firstly, you can use glob to get a list containing the name of each directory that starts with td like such:
dirs = glob.glob(td.*) You can find the
documentation about glob here.
Next, you'll want to iterate over the list that glob returns by doing something along the lines of
for dir in dirs: .
Finally, to remove there exists a built-in
os.rmdir(dir) which will remove the directory specified. Read up on the various operating system interfaces that the os module offers
here.
Last edited by jlm699; Jul 23rd, 2009 at 2:47 pm. Reason: icode tag fix
Reputation Points: 355
Solved Threads: 292
Veteran Poster
Offline 1,102 posts
since Jul 2008