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 .
jlm699
Veteran Poster
1,112 posts since Jul 2008
Reputation Points: 355
Solved Threads: 292