Is there a way to increase ARG_MAX?

ISSUE : “argument list too long” on any commands that have a long output…

WHEN I DO : getconf ARG_MAX I get a value like 2097152

QUESTION : Is there a way to increase that value ?

IF NOT : is there a way to do a split/chunk to a file instead or a large value returned ?

example a directery with millions of files… ls is sometimes reaching the ARG_MAX limit… :frowning: how can I get a listing of a hughe directory in an array and loop scripts and conditions…

!!! I FOUND A SOLUTION :wink:

for f in /path/*.ext; do echo “$f” ; done

this avoids the ARG_MAX and ALL lines are echoed

I can even do a shell_exec from php and it works very well

find /path -name ‘*.ext’ -print0 | xargs -0 some_command_to_run_on_a_batch_of_files