Mac Terminal: Loop through subdirectories and optimise all images
You can run it with find: find images/path -type f -name '*.png' -exec sips -Z 1024 {} \;
Find will search for files (-type f), with png extension (-name '*.png') inside 'images/path' directory and exec the command in parameter, replacing "{}" with the filename, you need to end the command with "\;".