S
S
Sergey Vasiliev2021-07-25 00:26:11
linux
Sergey Vasiliev, 2021-07-25 00:26:11

How to make find faster?

It is required to find all json files in the directories and pack them into an archive. There are about 100 thousand of them.
Now it all works through the command:

find /var/lib/pterodactyl/volumes/ -regex '.*\(.json\)' -size -200000k -exec tar -rvf /back.tar {} \;

But this is done very slowly, about 1 file per second, I've been waiting for 2 days, but it's still being packed, is there a way to speed it all up?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
ky0, 2021-07-25
@ky0

I would break the task into two stages - first you collect findall the paths to the files, then you set the archiver on the resulting list. And why -regex, which probably gives an overhead, if you can just search by mask?

V
Victor Taran, 2021-07-25
@shambler81

instead execuse xargs- profit every
200 times. Will acceleration suit you 200 times?

H
HighMan, 2021-07-26
@HighMan

find /var/lib/pterodactyl/volumes/ -type f - name '*.json' --size -200000k -exec tar -rvf /back.tar {} \;
Maybe it will be faster

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question