Reputation: 1134
I trying to achieve parallel find to reduce big FS traversing time:
find $1 -mindepth 2 -maxdepth 2 -type d | xargs -P5 -n1 find
works good but five (-P5) "find" processes run in parallel mess their output so strings break apart sometimes. How to rid off this behavior? Should be а usual problem with xargs but seems nobody uses its parallel feature.
Upvotes: 2
Views: 262
Reputation: 1086
You can write to separate files using
find $1 -mindepth 2 -maxdepth 2 -type d -print0 | xargs -0 -P5 -n1 -I{} sh -c 'find "{}" > "/tmp/{}.dirlist.txt"'
And then cat
ing them together at the end.
Upvotes: 2