获取添加到文件夹的最后一项的 URL

Get the URL of the last item added to a folder

所以我有一个将文件上传到特定文件夹的脚本。我想获取该文件夹中最近上传的项目的 URL?我将如何以尽可能简单的方式完成此操作。

例如,假设我有一个名为 "Photos" 的文件夹,我想检索上传到该文件夹​​的最新项目并将其显示在某处。我怎样才能得到 URL?您可以假设 "Photos" 是一个共享文件夹。

  • 哈希文件名,将最后一个文件名存储到数据库中
  • 使用时间戳重命名文件名

您可以通过脚本执行此操作。只需首先检索具有 最近的 getDateCreated() 的文件,然后检索具有 getUrl() 的 URL 的文件。文档中对两者的描述:

getDateCreated()

Gets the date the File was created.

getUrl()

Gets the URL that can be used to open the File in a Google App like Drive or Docs.

找到有关如何在云端硬盘文件夹中检索最新文件的帖子:

  • How to identify the most recent file in a Google Drive folder