Remove certain filetypes in Python
Posted
by Gareth
on Stack Overflow
See other posts from Stack Overflow
or by Gareth
Published on 2010-06-03T00:53:56Z
Indexed on
2010/06/03
1:04 UTC
Read the original article
Hit count: 381
python
Hello. I am running a script that walks a directory structure and generates new files in each folder in the directory. I want to delete some of the files right after creation. This is my idea, but it is quite wrong I imagine:
directory = os.path.dirname(obj)
m = MeshExporterApplication(directory)
os.remove(os.path.join(directory,"*.mesh.xml"))
How to you put wildcards in a path? I guess not like /home/me/*.txt, but that is what I am trying.
Thanks, Gareth
© Stack Overflow or respective owner