Skip to content

Instantly share code, notes, and snippets.

@Xiryl
Created February 11, 2023 13:06
Show Gist options
  • Save Xiryl/bd2012bac23ebce4e3da1e4caf7e2699 to your computer and use it in GitHub Desktop.
Save Xiryl/bd2012bac23ebce4e3da1e4caf7e2699 to your computer and use it in GitHub Desktop.
driveapimedium-github-5
for (file in files) {
val gfile = com.google.api.services.drive.model.File()
val fileContent = FileContent("your_mime", file)
gfile.name = file.name
val parents: MutableList<String> = ArrayList(1)
parents.add("folder_id") // Here you need to get the parent folder id
gfile.parents = parents
drive.Files().create(gfile, fileContent).setFields("id").execute()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment