Remove all files that match name in a list
To delete a list of comma separated filenames from a folder, you can use the following:

tr , '\n' &lt;&lt;&lt; "file.jpg,second.jpg,…" | xargs -I{} rm /path/to/folder/{}


Replace file.jpg,second.jpg,… with your comma separated list of files.
Replace /path/to/folder with the path to the containing folder of the images.

tr , '\n' replaces commas in the input with new lines. xargs takes the lines and runs the given command for each line, replacing {} with each line input (as instructed by -I{}). tr is used since xargs in macOS does not support -d for a custom delimiter.

However, I notice that your list does not include file extensions. You can add the extension to the end of the command instead.

tr , '\n' &lt;&lt;&lt; "file,second,…" | xargs -I{} rm /path/to/folder/{}.jpg