我想看到一个数据文件,可以显示文件名,文件夹名,上次修改日期,即今天和用户修改。
由于我有很多文件夹,我必须查看所有文件夹,以查看哪个文件被修改,所以尝试查看colab或google_picker_api https://developers.google.com/picker/docs或
由google_drive_api或google_activity_api 这里
例如:
for file in drive_folder:
if file_modified ==current_Date in file.data:
print(file, user_modifed,date_modifed)desire_output:
file_name folder last_date_modified user_modified
0 spreadsheet abc 20220307 'david'发布于 2022-03-07 20:08:51
为了收集文件列表,您需要使用Drive V3。
我找到了一个使用查询的Python代码和文档示例。
其中一个示例可以让您找到"在给定日期后修改的文件“
获取文件夹(最后一次修改、用户和修改)所需的参数或字段如下:
实际上,您可以测试驱动器files.get或files.list的API。
对于files.list:
在“字段”参数上,只需添加"*“,它将为所有字段提供有关组织文件的数据。
对于files.get:
您可以添加与上面相同的内容和任何特定文件的ID。
基于Python的quickstart。的示例代码编辑
# Call the Drive v3 API
results = service.files().list(
pageSize=10,
fields="parent, files(id, name)",
q="modifiedTime > '2012-06-04T12:00:00-08:00'").execute()
items = results.get('files', [])
if not items:
print('No files found.')
else:
print('Files:')
for item in items:
print('{0} ({1})'.format(item['name'], item['id']))
https://stackoverflow.com/questions/71385669
复制相似问题