1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import time
nb=int(sys.argv[1]) * 320 / 4096
zero=len("%s" % nb)
epoch=time.time()
for i in xrange(nb):
if (i % 32000) == 0:
base=i
open("xxx/_%0*d" % (zero, base), "w").close()
else:
os.link(
"xxx/_%0*d" % (zero, base),
"xxx/_%0*d" % (zero, i),
)
# if
if (i % 100000) == 0:
print "%s %.02f%% %d/%d" % (
time.strftime(
"%Hh %Mmn %Ss",
time.gmtime(time.time() - epoch),
),
i * 100.0 / nb,
i,
nb,
)
# if
# for |
Partager