filelist.sort()
files = result = manifest = objects = 0
size = 0
+batchsize = 0
columns = os.get_terminal_size()[0]
width = min(columns - 22, 100)
bar = progress.bar.Bar(
val = open(os.path.join(dirpath, filename), "rb").read() or None
if val:
# print("%s: %s %d" % (key, ext, len(val)))
- pipe.set(key, val)
+ pipe.setnx(key, val)
objects = objects + 1
files = files + 1
size = size + filesize
+ batchsize = batchsize + filesize
+ if batchsize > 64 * 1024 * 1024:
+ pipe.execute()
+ batchsize = 0
bar.next()
+pipe.execute()
bar.finish()
print(
"%d files, %d result (%d manifest) = %d objects (%s)"