Reputation: 1088
How can I transfer a large folder of video files (~400 GB of basketball game film) from one account to another? I can't just use the "change ownership" tool, as this is from Account A (my school account) to Account B (my personal account). I have access to the Google Takeout tool, but I don't think I can transfer from one Google Drive to another account from there without using another platform in the middle and requiring a full download of things and reupload, which is not practical with this many large files.
(Before there's concerns, all of this data is data I created, and am responsible for; not copyrighted/pirated footage.)
Upvotes: 1
Views: 2040
Reputation: 201378
I believe your situation and goal as follows.
For this, how about this answer? I think that your goal can be achieve using Google Apps Script. The flow of this sample script is as follows.
Please do the following flow.
Sample script of Web Apps is a Google Apps Script. So please create a project of Google Apps Script.
If you want to directly create it, please access to https://script.new/. In this case, if you are not logged in Google, the log in screen is opened. So please log in to Google. By this, the script editor of Google Apps Script is opened.
In this answer, a Google Apps Script library is used. It's BatchRequest. By using this library, the file copy can be done with the asynchronous process. By this, the process cost can be reduced a little than that with the synchronous process.
About the method for installing the library, please check here.
Please enable Drive API at Advanced Google services. By this, Drive API is automatically enabled at API console. In this sample script, Drive API v3 is used.
Please copy and paste the following script. And please set the source folder ID to sourceFolderId
. In your case, the top folder ID of They are in several folders, nested inside of one main folder.
. And also, please set the destination folder ID to destinationFolderId
. In this case, please set the folder ID in your Google Drive.
function myFunction() {
const sourceFolderId = "###"; // Please set the source folder ID.
const destinationFolderId = "###"; // Please set the destination folder ID.
const getFiles = (id, res = []) => {
const folder = DriveApp.getFolderById(id);
const files = folder.getFiles();
while (files.hasNext()) {
const file = files.next();
res.push({name: file.getName(), id: file.getId()})
}
let ids = [];
const folders = folder.getFolders();
while (folders.hasNext()) ids.push(folders.next().getId());
if (ids.length > 0) ids.forEach(id => getFiles(id, res));
return res;
}
const files = getFiles(sourceFolderId);
const limit = 100;
const split = Math.ceil(files.length / limit);
for (let i = 0; i < split; i++) {
const batches = files.splice(0, limit).map(f => ({
method: "POST",
endpoint: `https://www.googleapis.com/drive/v3/files/${f.id}/copy?supportsAllDrives=true`,
requestBody: {name: f.name, parents: [destinationFolderId]},
}));
const requests = {batchPath: "batch/drive/v3", requests: batches};
const result = BatchRequest.Do(requests);
console.log(result.getContentText());
}
// DriveApp.createFile() // This comment line is used for automatically detecting the scope of `https://www.googleapis.com/auth/drive` with the script editor. So please don't remove this line.
}
destinationFolderId
.Upvotes: 5
Reputation: 109
Way too late for the original question, but there are two "userspace" options, other than download/upload:
1: Share & copy
Share the entire tree (from as high as you can) from account A to account B. In account B, copy the tree, then undo the share. All will be done cloudside, so no downloading is involved.
2: Google Takeout / Transfer
This option requires that your institution has enabled this facility (an addition to the Takeout service) for your account, but if it has done so, you can go to https://takeout.google.com/transfer and point it to Account B. This will transfer all material (mail, files, whatnot) to Account B. Mail will be labeled, Drive files will be placed in a top level folder in de Drive of Account B. NB: this applies only to files that are owned by Account A, so make sure you know what's what and clean up ownership within Domain A beforehand.
Google documentation for this feature
Note: this feature is only available in EDU Workspace accounts and (maybe, I cannot verify) Enterprise level Workspace.
Upvotes: 1