I have a multi-level directory of jpegs that I want to optimise on a semi-regular basis (as things are added). The command I'm using jpegoptim
is single-threaded so when I run the following, only one CPU core is engaged and it takes a long time.
find media -exec jpegoptim --strip-all {} +
Given there are so many files and I have 8 CPU threads available, can I split the workload so it's running on all of them?
find media -print0 | xargs -L1 -0 -P0 jpegoptim --strip-all
Magic. – Oli Aug 27 '15 at 07:37