Remove all files that match name in a list I have a folder with a lot of images.

My client sent me a list of rejected images I need to delete from that folder.

The list is like this: _001,_002,_003,_004,_006,_007,RAM08953,RAM08995,RAM08996,RAM09039,RAM09060,RAM09087,RAM09101,RAM09104,RAM09115,RAM09126,RAM09170,RAM09171,RAM09172,RAM09176,RAM09188.

How can I easily run something that delete those files, or move those files inside a new folder or something without doing by hand? It can be an app, shell script or any tip.
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