找到与功放更有效的方式;焦油数百万个文件 [英] More efficient way to find & tar millions of files

查看:125
本文介绍了找到与功放更有效的方式;焦油数百万个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得在命令行提示符下两那时的我,服务器上运行的工作现在:

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 {} ;

据正在 永远,然后一些。是的,有数百万人在目标目录中的文件。 (每个文件是在一个良好散列目录结构可怜的8个字节)。但只是运行...

It is taking forever, and then some. Yes, there are millions of files in the target directory. (Each file is a measly 8 bytes in a well hashed directory structure.) But just running...

find data/ -name filepattern-*2009* -print > filesOfInterest.txt

...只需要两小时左右。在速度我的工作运行时,它不会被完成了一对夫妇的的..这似乎是不合理的。 有没有更有效的做到这一点?或许有更复杂的bash脚本?

...takes only two hours or so. At the rate my job is running, it won't be finished for a couple of weeks.. That seems unreasonable. Is there a more efficient to do this? Maybe with a more complicated bash script?

一个次要的问题是的为什么我目前的做法这么慢?

推荐答案

如果你已经这样做创建的文件列表中的第二个命令,只需使用 -T 选项告诉tar来从已保存的文件列表读取文件名。运行1 tar命令VSñ焦油命令会好很多。

If you already did the second command that created the file list, just use the -T option to tell tar to read the files names from that saved file list. Running 1 tar command vs N tar commands will be a lot better.

这篇关于找到与功放更有效的方式;焦油数百万个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆