Changeset View
Changeset View
Standalone View
Standalone View
bin/swh-storage-add-dir
Show All 30 Lines | if __name__ == '__main__': | ||||
def list_content(): | def list_content(): | ||||
for root, _dirs, files in os.walk(dirname): | for root, _dirs, files in os.walk(dirname): | ||||
for name in files: | for name in files: | ||||
path = os.path.join(root, name) | path = os.path.join(root, name) | ||||
cont = _hash_fname(path) | cont = _hash_fname(path) | ||||
cont['data'] = open(path, 'rb').read() | cont['data'] = open(path, 'rb').read() | ||||
yield cont | yield cont | ||||
storage.add_content(list_content()) | storage.content_add(list_content()) |