PyDrive2 icon indicating copy to clipboard operation
PyDrive2 copied to clipboard

GDriveFileSystem support for shared files / shortcuts

Open simone-viozzi opened this issue 3 years ago • 1 comments

Hi, does GDriveFileSystem support manipulation of files in the shared with me folder? Like copy from my drive to a folder shared with me.

If not, I can create a shortcut in my drive and use the shortcut as path for the file / folder?

From the tries I have done, the second option doesn't work, GDriveFileSystem does not take care of getting the targetId of the shortcut etc..

I would like shortcut to be transparent proxies to the real file / folder, so that for example ls on the shortcut of a folder give me the content of it. Things get complicated with other methods like:

  • you can copy a shortcut of a folder, but not the folder itself (at least not in one API call)

Reference:

  • https://github.com/iterative/PyDrive2/issues/74
  • https://github.com/iterative/PyDrive2/issues/218

simone-viozzi avatar Oct 24 '22 10:10 simone-viozzi

I don't think PyDrive2 currently supports this functionality automatically, but it would be great if it did. Having a method like this on GoogleDriveFile would be super helpful as a start:

    def FollowShortcut(self):
        if self["mimeType"] == "application/vnd.google-apps.shortcut":
            self.FetchMetadata(fields="shortcutDetails")
            return GoogleDriveFile(self.auth, {"id": gdrive_file["shortcutDetails"]["targetId"]})
        else:
            return self

aripollak avatar Sep 28 '23 20:09 aripollak