koleto115
asked on
How to delete similar files with python?
I would like to delete similar files quietly with some extension under windows with python.
What I have up to now is this:
import os
os.system('del *.log')
But since this is shel command executed it always throw some stupid output if no files with this extension were found. How to delete files quietly from a python module?
What I have up to now is this:
import os
os.system('del *.log')
But since this is shel command executed it always throw some stupid output if no files with this extension were found. How to delete files quietly from a python module?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You are welcome. Also, have a look at the shutil module that implements a lot of functionality that is used in shell scripts (http://docs.python.org/library/shutil.html).
ASKER