Thursday, November 18, 2021

[SOLVED] Look for all images in the system then copy them to a folder

Issue

This is the code I used.

find . -regex '.*\(jpg\|jpeg\|png\|gif\)' \! -path './ToutesImages/*' -exec echo cp -t ToutesImages {} +

This is the terminal output

Because it shows me all images in the system and echoes my code i guess something with the -exec echo cp -t ToutesImages {} + is wrong. Does anyone know how I can improve this?

File manager. Just in case


Solution

The echo is there as a dry run so you can preview the command that will be executed. If it looks like the right set of files then delete it to actually perform the copy.



Answered By - John Kugelman