More efficient way to find & tar millions of files

前端 未结 9 578
一向
一向 2021-01-30 17:53

I\'ve got a job running on my server at the command line prompt for a two days now:

find data/ -name filepattern-*2009* -exec tar uf 2009.tar {} ;
9条回答
  •  -上瘾入骨i
    2021-01-30 18:56

    There is xargs for this:

    find data/ -name filepattern-*2009* -print0 | xargs -0 tar uf 2009.tar
    

    Guessing why it is slow is hard as there is not much information. What is the structure of the directory, what filesystem do you use, how it was configured on creating. Having milions of files in single directory is quite hard situation for most filesystems.

提交回复
热议问题