Apply an operation to each of the files in a directory, producing a new directory of files.
Define a source directory
Define the source directory that contains the files to operate on:
Define a destination directory
Define the destination directory for the processed files, in this case, an automatically created temporary directory:
Make a function to apply to the contents of a file
Define a function to apply to the contents of each file. This function makes a line drawing from an image:
Test the function:
Apply the function to files in the source directory, putting the results in the destination directory
Apply the function to the PNG files in the source directory. These are the source files:
Import each source file, apply the function and export to a file in the destination directory with the same name as the source file:
Verify the result
Verify the contents of the destination directory: