with open(processed_files_file, 'a') as pff:
    for root, dirs, files in os.walk(path):
        for file in files:
            if file.endswith('.gz'):
                pass
How to process only new (unprocessed) files in linux