from fit2gpx import Converter from os import listdir from os.path import isfile, join mypath='/container/directory' onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))] conv = Converter() for f in onlyfiles: if "activity_uncompleted" in f: print(" Ignore" + f) elif f.endswith(".fit"): print(mypath+'/'+f) gpx = conv.fit_to_gpx(f_in=mypath+'/'+f, f_out=mypath+'/'+f+'test.gpx')