0

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

jww
  • 97,681
  • 90
  • 411
  • 885
  • Asked and answered *ad nauseam*. How is you problem different than the other Q&A's, and why did the answers that tell you to use `find` did not work? – jww May 10 '19 at 18:21

2 Answers2

4

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
GoinOff
  • 1,792
  • 1
  • 18
  • 37
2

Try this:

jpegoptim -m80 *.jpg

or

jpegoptim --max=80 *.jpg

If having a large number of file you must use for command like this:

for f in *.jpg; do jpegoptim -m80 "$f"; done

You should user jpegoptim --help for more information about the use of jpegoptim.