Hi,
We’ve been using the Python SDK to run a nightly job that gives us a list of all the files (and some metadata) in our account.
That job historically took about 30 minutes to complete, recursively going through all the directories, etc. As of a few days ago (11/5), though, it suddenly doubled in length, even though the number of files/folders in our account hadn’t changed.
So two questions:
- Has anyone else noticed anything similar over the last few days?
- Is there a better/different way to get to that data?
Our current function looks something like this:
def get_recursive_files(settings, client, folder_id, path_prefix=None):
file_list = t]
folder = client.folder(folder_id).get()
for item in folder.get_items():
if item.type == 'folder':
file_list += get_recursive_files(settings, client, item.id, path_prefix)
else:
file = item.get(fields=l'id', 'name', 'created_by', 'created_at', 'modified_by', 'modified_at', 'path_collection', 'version_number'])
file_path = '/'.join(oe.name for e in file.path_collectiont'entries']])
if path_prefix is not None:
if file_path.startswith(path_prefix):
file_path = file_pathplen(path_prefix):]
if file_path.startswith('/'):
file_path = file_pathp1:]
created_by = f'{file.created_by.name} <{file.created_by.login}>' if file.created_by.name != "Anonymous User" else f'{file.created_by.name}'
modified_by = f'{file.modified_by.name} <{file.modified_by.login}>' if file.modified_by.name != "Anonymous User" else f'{file.modified_by.name}'
f_dict = {
'id': file.id,
'name': file.name,
'created_by': created_by,
'created_at': file.created_at,
'modified_by': modified_by,
'modified_at': file.modified_at,
'file_path': file_path,
'url': f'/file/{file.id}',
'version_number': file.version_number,
'folder_id': folder_id
}
file_list.append(f_dict)
return file_list