I have two folders Folder1
and Folder2
in my Google drive.
I have created a google drive document doc1
in Folder1. Later i need to copy this document to Folder2. How can i achieve this.
I tried the below link but its creating the copy on the same folder.
https://developers.google.com/drive/v2/reference/files/copy
/**
* Copy an existing file.
*
* @param {String} originFileId ID of the origin file to copy.
* @param {String} copyTitle Title of the copy.
*/
function copyFile(originFileId, copyTitle) {
var body = {'title': copyTitle};
var request = gapi.client.drive.files.copy({
'fileId': originFileId,
'resource': body
});
request.execute(function(resp) {
console.log('Copy ID: ' + resp.id);
});
}