GNU Parallel, too many input files, Argument list too long

macos, parallel-processing, unix

Solution

Try:

ls samplefolder | grep \.txt | parallel "sample operation samplefolder/{}" 

Problem

I run a command like this on my macbook, using GNU Parallel: ``` parallel "sample operation" ::: samplefolder/*.txt ``` The problem is that I have 20,000 txt files in the `samplefolder`, which cause a `Argument list too long` error. And there's no such a problem when I tried run the same script on an ubuntu machine. I tried googling and reading some `man` files, but no luck. How can I solve this problem? Thanks!

Original source