iterative / PyDrive2

Google Drive API Python wrapper library. Maintained fork of PyDrive.
https://docs.iterative.ai/PyDrive2
Other
570 stars 70 forks source link

How to distinguish between same-named files and directories in Google Drive #295

Open muhammadalie opened 1 year ago

muhammadalie commented 1 year ago

How to distinguish between same-named files and directories in Google Drive ?

In my GDrive, I have encountered a situation where there are two files with the same name (test1) and identical sizes. To obtain the list of files along with their details, I used fsspec.ls with detail=True, resulting in the following output:

[{'type': 'file', 'name': 'root/testFolder/test1', 'size': 1024, 'checksum': None}, {'type': 'file', 'name': 'root/testFolder/test1', 'size': 1024, 'checksum': None}] 

As you can see, both files have the same name and path. Now, I am uncertain about which file will be downloaded if I attempt to do so using the provided name.

will it fix If we add item_ids in metadata ?

shcheklein commented 1 year ago

Yes, we can try to add the ids. (fsspec for PyDrive is quite broken though in many places for a general use- i would recommend to be careful with it. )