I\'m trying to build a function that will remove all the files that start with \'prepend\' from the root of my project. Here\'s what I have so far
def cleanu
Would you consider this approach using os.remove() to deleting files instead of rm
:
import os
os.remove('Path/To/filename.ext')
Update (basically moving my comment from below into my answer):
As os.remove()
can't handle wildcards on its own, using the glob module to help will yield a solution as repeated verbatim from this SO answer:
import glob
import os
for fl in glob.glob("E:\\test\\*.txt"):
#Do what you want with the file
os.remove(fl)