diff --git a/parseFitFiles.py b/parseFitFiles.py index ca82ea3..04002f8 100644 --- a/parseFitFiles.py +++ b/parseFitFiles.py @@ -129,10 +129,10 @@ def writeDB(): def deleteFiles(filename): try: - file = filename[:-4] - #print(file) - os.unlink(path+file+".*") - print("lösche", file) + for fname in os.listdir(path): + if fname.startswith(filename[:-4]): + os.remove(os.path.join(path, fname)) + print("lösche", fname) except Exception as e: print('Failed to delete %s. Reason: %s' % (path+filename, e))