1
cheneydog 2017 年 5 月 5 日 ls /xxx >list
|
2
sheep3 2017 年 5 月 5 日
```
import subprocess cat = subprocess.Popen(["ll",], stdout=subprocess.PIPE) for line in cat.stdout: print line ``` |
3
dsg001 2017 年 5 月 5 日
```
import glob for file in glob.iglob('path'): print(file) ''' |
4
minbaby 2017 年 5 月 5 日
一看楼上就是没有遇到过几百万文件在一个目录的情况,之前遇到过(因为 crontab 用了 wget 导致的),用 ls 命令已经不好使了,这个时候只能通过文件名字的规律来处理了,比如文件名是五位数字,可以试试 ls 11* 这种方式缩小每次读取的文件数量
|
5
rrfeng 2017 年 5 月 5 日 ls -U
|
6
Osk 2017 年 5 月 5 日 $ time ls -U | wc -l
5973243 real 0m2.330s user 0m1.743s sys 0m0.790s 不用-U 要 24 秒多 |
8
Ouyangan 2017 年 5 月 5 日
100 万 , 真刺激
|
9
lxf1992521 2017 年 5 月 5 日
find > a 生成索引,在使用 python 去处理一个几百万行的文本即可。
|
10
dbj1991 OP |
12
ihciah 2017 年 5 月 6 日
想起某童鞋经历过的 inode 用完的情况。。。。
|