I have a Python program which generates lots of files in different folders for each iteration.
After each iteration, I would like to delete a certain kind of files inside a specific folder: For example, all those with this extension *.recode.vcf
should be removed.
I tried
os.remove(example.recode.vcf)
... but as the folder where is looking for the file might, eventually, contain lots of files, I was wondering which would be the most efficient way to do it.
As an alternative, I thought about calling bash find
function. Something like...
find . -name \*.recode.vcf -type f -delete
What do you think?