More efficient way to find & tar millions of files

前端 未结 9 603
一向
一向 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条回答
  •  南笙
    南笙 (楼主)
    2021-01-30 18:59

    One option is to use cpio to generate a tar-format archive:

    $ find data/ -name "filepattern-*2009*" | cpio -ov --format=ustar > 2009.tar
    

    cpio works natively with a list of filenames from stdin, rather than a top-level directory, which makes it an ideal tool for this situation.

提交回复
热议问题