FIRSTA ANGGA YS
FIRSTA ANGGA YS

Reputation: 23

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

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

Upvotes: 0

Views: 538

Answers (3)

Php Editor
Php Editor

Reputation: 1

This example for long list: for f in /var/www//.*; do jpegoptim --max=80 --overwrite "$f"; done

Upvotes: 0

GoinOff
GoinOff

Reputation: 1802

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

Upvotes: 4

whererichstay
whererichstay

Reputation: 21

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.

Upvotes: 2

Related Questions