function moveFile($service, $fileId, $parentId) { try { $file = new Google_DriveFile(); $file->setParent($parentId); $updatedFile = $service->files->patch($fileId, $file, array('fields' => 'parents')); return $updatedFile; } catch (Exception $e) { print "An error occurred: " . $e->getMessage(); } }