import os;

removedCsvCount = 0;
removedPngCount = 0;
removedAviCount = 0;

# Remove all the files generated by the MATLAB code for tracking the table tennis ball
for camNum in [1, 2, 3]:
    resultDir = os.path.join('.', 'Videos', 'CAM' + str(camNum));
    for file in os.listdir(resultDir):
        pathToResult = os.path.join(resultDir, file);

        if file.endswith(".csv"):
            # Remove the csv file containing tracking coordinates results of a video
            os.remove(pathToResult)
            removedCsvCount += 1

        if file.endswith(".png"):
            # Remove the png file containing the averaged background of a video
            os.remove(pathToResult)
            removedPngCount += 1

        if file.endswith(".avi"):
            # Remove the png file containing the averaged background of a video
            os.remove(pathToResult)
            removedAviCount += 1

print("Removed ", removedCsvCount, " csv files");
print("Removed ", removedPngCount, " png files");
print("Removed ", removedAviCount, " avi files");
