def traverse_and_touch(directory, touch):
    """
  General function for traversing a local directory. Walks through
  the entire directory, and touches all files with a specified function.
  """
for root, dirs, files in os.walk(directory):
    for filename in files:
        touch(os.path.join(root, filename))
return
Modify python script to run on every file in a directory