Sunday, January 28, 2024

[SOLVED] Argument list too long in Centos after using jpegoptim -m 80 *.jpg

Issue

I want to compress all jpg files in directory /var/sentora/hostdata/zadmin/public_html/mysite_com/_files/photo/ using jpegoptim`.

I use code jpegoptim -m 80 *.jpg but it shows error "Argument list too long".

Previously I have increased the ulimit -s 65536 but it still shows error "Argument list too long".

Please help me to solve the problem

You can see the screenshot here


Solution

Try using find and xargs with jpegoptim:

find . -name "*.jpg" -print0 | xargs -0 jpegoptim -m 80

non-recursive:

find . -maxdepth 1 -name "*.jpg" -print0 | xargs -0 jpegoptim -m 80


Answered By - GoinOff
Answer Checked By - Willingham (WPSolving Volunteer)