How to work with millions of files when xargs does not work
In some cluster I need to enter in some directory and list and select some files. The problem is that probably there are even millions of very small files. If I do
ls -l
It is very inefficient. But if I try a supposed to be better alternative like
find . -name "*.mol2" | xargs ls
It takes minutes and I do not get any answer ...
I wonder if there are better/faster methods for situations like this one. Of course I could tell the person who generated all these files something, but thi开发者_如何学Gos is out of the scope of the question. Thanks
The obvious would be:
find . -name "*.mol2"
But with millions of files it will still take time - at least the first time. The second time the dir will hopefully be cached.
For the outside scope: Create subdirs maybe named as substrings, so foobarbaz123.mpl2 will go into foo/bar/baz/foobarbaz123.mpl2
How about ls -al *.mol2 .*mol2
?
精彩评论