I have a py script that processes files with the extension '.hgx'.Example: test.hgx (there are many such files with the extension hgx)
The script processes test.hgx and creates a new test_bac.hgx, and when you run it again, it creates test_bac_bac.hgx. Therefore, each time the script is run, a file with '_ bac' is created.
Is there any solution that I can use in my script that can delete all existing files '_ bac' and '_bac_bac ...' before the actual code starts.
I already use the glob.glob function
for hgx in glob.glob("*.hgx"):
Can I use this function to delete these “X_bac.hgx” files and other _bac_bac..hgx files?
Any help / idea would be appreciated.
thanks
user741592
source share