Dropbox Core API> 10000文件移动策略

时间:2014-07-19 18:48:07

标签: python python-2.7 dropbox dropbox-api

我将包含大约50,000个文件的iPhoto图库同步到Dropbox文件夹,但想将其移动到其他文件夹。当我尝试通过dropbox.com移动文件夹时,它说'#34;文件太多,使用桌面应用程序"。所以我改为安装dropbox for python(pip install dropbox)并按照教程设置代码并运行:

db_client2.file_move('/Personal Pictures/iPhoto Library', '/temp/iPhoto Library')

如文档中所列,文件大小限制为10,000:

dropbox.rest.ErrorResponse: [406] u'There are too many files involved in this operation.'

你们用什么策略来移动包含那么多文件的单个文件夹?

1 个答案:

答案 0 :(得分:0)

此解决方案“缓慢”,但无人值守:

files= list_files(db_client2, path_prefix='/Personal Pictures/iPhoto Library', include_media_info=True)

for k, v in files.iteritems():
    final_path = k.replace('/personal pictures/', '/temp/')
    if v['is_dir'] == True:
        print k + " is a dir and is skipped"
    else:
        db_client2.file_move(k, final_path)
        print "moved " + k