2 ms·
> > No length limits. If I'm processing 10K files, I don't want to run into the problem that the command line is too long. > Do not evaluate arguments directly
by Izkata 5y ago
> > No length limits. If I'm processing 10K files, I don't want to run into the problem that the command line is too long.
> Do not evaluate arguments directly in shell, use xargs to feed the arguments as standard input. E.g.:
> find ./directory/ -type f | xargs SOME_COMMAND
That'll have problems with characters like spaces, you either have to use the -print0 construct or just stick with find:
find ./directory/ -type f -exec SOME_COMMAND {} +
The + means "stack up as many results as you can, up to the length limit".
- paskozdilar 5y agoNice, I didn't know about that. Thanks for sharing!