Closed meet1919 closed 8 months ago
Yes, PyDrive2 API is quite "specific". Sorry, about that it's a legacy that we are replacing gradually with fsspec
compatible implementation here.
I would give it a try, I think this spec should be enough to try along with the link above.
For the native PyDrive2 api, to make it work you need to create instance of the file
object to manipulate with it.
file_id = "id" # you need to know this ID, can be taken in UI, or using other PyDrive2 helpers, something like this:
file_to_copy = drive.CreateFile({"id": file_id})
directory_to_copy_to = drive.CreateFile({"id": directory_id}) # optional
file_to_copy.Copy(target_folder=directory_to_copy_to, new_title="if you need this")
May be tests in https://github.com/iterative/PyDrive2/pull/188/files , could also help you get a better idea on how this API works.
I see, I can use this cp(["source/file1", "source/file2", "source/subdir/subfile1"], "target/")
for copying multiple files to target folder. Just wondering (might be a little silly), what will be the file path here in reference to the drive?
Should it be like cp(["file1_id", "file2_id"], "target_folder_id")
?
@shcheklein
I am using the code as below:
But I am getting the error as below:
Well I can see this in the API reference:
But I am not sure how to use it